* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #0a1628 0%, #1a3a5c 50%, #0a1628 100%);
    min-height: 100vh;
    color: #fff;
}

.trivia-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.back-btn {
    display: inline-block;
    color: #00bfff;
    text-decoration: none;
    font-size: 1em;
    padding: 10px 0;
    transition: color 0.3s;
}

.back-btn:hover {
    color: #00dfff;
}

.trivia-header {
    text-align: center;
    margin-bottom: 30px;
}

.trivia-header h1 {
    font-size: 2.5em;
    color: #00bfff;
    text-shadow: 3px 3px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    margin-bottom: 20px;
}

.stats-bar {
    display: flex;
    justify-content: space-around;
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 10px;
    border: 3px solid #00bfff;
}

.stat-item {
    font-size: 1.2em;
    font-weight: bold;
}

.stat-label {
    color: #00bfff;
    margin-right: 5px;
}

/* Screens */
.screen {
    background: rgba(0, 0, 0, 0.7);
    padding: 40px;
    border-radius: 15px;
    border: 3px solid #00bfff;
    box-shadow: 0 0 30px rgba(0, 191, 255, 0.3);
}

.screen h2 {
    font-size: 2em;
    color: #00bfff;
    margin-bottom: 20px;
    text-align: center;
}

.screen p {
    color: #ccc;
    margin-bottom: 15px;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Start Screen */
.settings-panel {
    background: rgba(0, 0, 0, 0.5);
    padding: 25px;
    border-radius: 10px;
    margin: 30px 0;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    color: #00bfff;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.setting-group select {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    font-family: 'Courier New', monospace;
    background: #1a1a1a;
    color: #fff;
    border: 2px solid #00bfff;
    border-radius: 5px;
    cursor: pointer;
}

.setting-group select:focus {
    outline: none;
    border-color: #00dfff;
    box-shadow: 0 0 10px rgba(0, 191, 255, 0.5);
}

.setting-hint {
    font-size: 0.85em;
    color: #888;
    margin-top: 8px;
    text-align: left;
}

.jservice-info {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid #ffd700;
    border-radius: 5px;
    padding: 15px;
    color: #ffd700;
    text-align: left;
    font-size: 0.95em;
    line-height: 1.5;
}

/* Text Answer Input (for jService) */
.text-answer-container {
    margin: 20px 0;
}

.text-answer-input {
    width: 100%;
    padding: 20px;
    font-size: 1.2em;
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: 3px solid #00bfff;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 15px;
}

.text-answer-input:focus {
    outline: none;
    border-color: #00dfff;
    box-shadow: 0 0 15px rgba(0, 191, 255, 0.5);
}

.text-answer-input::placeholder {
    color: #666;
}

.text-answer-input:disabled {
    background: rgba(0, 0, 0, 0.3);
    border-color: #444;
    color: #888;
}

.text-answer-input.correct {
    border-color: #4caf50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

.text-answer-input.incorrect {
    border-color: #f44336;
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.5);
}

/* Value badge for jService */
.value-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    margin-bottom: 10px;
    margin-right: 10px;
    background: rgba(255, 215, 0, 0.3);
    color: #ffd700;
    font-weight: bold;
}

/* Buttons */
.primary-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 20px auto 0;
    background: linear-gradient(180deg, #00bfff 0%, #0099cc 100%);
    color: #000;
    border: none;
    padding: 15px 40px;
    font-size: 1.3em;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    letter-spacing: 2px;
}

.primary-btn:hover {
    background: linear-gradient(180deg, #00dfff 0%, #00bfff 100%);
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 191, 255, 0.4);
}

.primary-btn:disabled {
    background: #444;
    cursor: not-allowed;
    transform: none;
}

.secondary-btn {
    display: inline-block;
    background: transparent;
    color: #00bfff;
    border: 2px solid #00bfff;
    padding: 15px 40px;
    font-size: 1.1em;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.secondary-btn:hover {
    background: rgba(0, 191, 255, 0.2);
}

/* Loading Screen */
.loader {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(0, 191, 255, 0.3);
    border-top-color: #00bfff;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Question Screen */
.category-badge,
.difficulty-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    margin-bottom: 10px;
    margin-right: 10px;
}

.category-badge {
    background: rgba(0, 191, 255, 0.3);
    color: #00bfff;
}

.difficulty-badge {
    background: rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

.difficulty-badge.easy {
    background: rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

.difficulty-badge.medium {
    background: rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

.difficulty-badge.hard {
    background: rgba(244, 67, 54, 0.3);
    color: #f44336;
}

.question-container {
    background: rgba(0, 0, 0, 0.5);
    padding: 30px;
    border-radius: 10px;
    margin: 20px 0;
}

.question-text {
    font-size: 1.4em;
    color: #fff;
    line-height: 1.6;
    text-align: center;
}

.answers-container {
    display: grid;
    gap: 15px;
    margin: 20px 0;
}

.answer-btn {
    background: rgba(0, 191, 255, 0.1);
    border: 2px solid #00bfff;
    color: #fff;
    padding: 20px;
    font-size: 1.1em;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
    text-align: left;
}

.answer-btn:hover:not(:disabled) {
    background: rgba(0, 191, 255, 0.3);
    transform: translateX(10px);
}

.answer-btn:disabled {
    cursor: not-allowed;
}

.answer-btn.correct {
    background: rgba(76, 175, 80, 0.5);
    border-color: #4caf50;
    animation: pulse-correct 0.5s ease;
}

.answer-btn.incorrect {
    background: rgba(244, 67, 54, 0.5);
    border-color: #f44336;
    animation: shake 0.5s ease;
}

@keyframes pulse-correct {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.feedback {
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.feedback.correct {
    background: rgba(76, 175, 80, 0.2);
    border: 2px solid #4caf50;
}

.feedback.incorrect {
    background: rgba(244, 67, 54, 0.2);
    border: 2px solid #f44336;
}

#feedbackText {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 10px;
}

.feedback.correct #feedbackText {
    color: #4caf50;
}

.feedback.incorrect #feedbackText {
    color: #f44336;
}

.correct-answer-text {
    color: #ccc;
    font-size: 1.1em;
}

/* Results Screen */
.results-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.result-stat {
    background: rgba(0, 0, 0, 0.5);
    padding: 25px;
    border-radius: 10px;
    text-align: center;
}

.result-value {
    display: block;
    font-size: 2.5em;
    color: #00bfff;
    font-weight: bold;
}

.result-label {
    display: block;
    color: #888;
    margin-top: 10px;
    font-size: 0.9em;
}

.results-breakdown {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
}

.breakdown-item {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    gap: 15px;
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.breakdown-question {
    flex: 1;
}

.breakdown-question p {
    text-align: left;
    margin: 0;
    color: #aaa;
    font-size: 0.95em;
}

.breakdown-question .your-answer {
    margin-top: 5px;
    font-size: 0.85em;
}

.breakdown-question .your-answer.correct {
    color: #4caf50;
}

.breakdown-question .your-answer.incorrect {
    color: #f44336;
}

.results-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.results-buttons .primary-btn,
.results-buttons .secondary-btn {
    margin: 0;
    min-width: 200px;
}

/* Results titles based on performance */
#resultsTitle.excellent {
    color: #ffd700;
}

#resultsTitle.good {
    color: #4caf50;
}

#resultsTitle.average {
    color: #ffc107;
}

#resultsTitle.poor {
    color: #f44336;
}

/* Error Screen */
#errorScreen {
    border-color: #f44336;
}

#errorScreen h2 {
    color: #f44336;
}

/* Scrollbar styling */
.results-breakdown::-webkit-scrollbar {
    width: 8px;
}

.results-breakdown::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.results-breakdown::-webkit-scrollbar-thumb {
    background: #00bfff;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 600px) {
    .trivia-header h1 {
        font-size: 1.8em;
    }

    .stats-bar {
        flex-direction: column;
        gap: 10px;
    }

    .stat-item {
        font-size: 1em;
    }

    .screen {
        padding: 20px;
    }

    .question-text {
        font-size: 1.2em;
    }

    .results-container {
        grid-template-columns: 1fr;
    }

    .results-buttons {
        flex-direction: column;
    }

    .results-buttons .primary-btn,
    .results-buttons .secondary-btn {
        width: 100%;
    }
}
