:root {
    --bg-color: #111827; /* gray-900 */
    --text-color: #f9fafb; /* gray-50 */
    --card-bg-color: #1f2937; /* gray-800 */
    --header-bg-color: #115e59; /* teal-900 */
    --header-text-color: #f9fafb; /* gray-50 */
    --primary-color: #14b8a6; /* teal-500 */
    --primary-hover-color: #0d9488; /* teal-600 */
    --secondary-text-color: #9ca3af; /* gray-400 */
    --border-color: #374151; /* gray-700 */
    --option-bg-hover: #1f2937; /* gray-800 */
    --option-border-hover: #14b8a6; /* teal-500 */
    --gold-color: #ffd700;
    --silver-color: #c0c0c0;
    --bronze-color: #cd7f32;
    --slider-track-bg: #374151; /* لون المسار */
    --slider-thumb-bg: #14b8a6; /* لون المؤشر (الدائرة) */
    --input-bg-color: #374151; /* gray-700 */
    --input-text-color: #f9fafb; /* gray-50 */
    --input-border-color: #4b5563; /* gray-600 */
    --placeholder-color: #9ca3af; /* gray-400 */
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}
.container { background-color: var(--card-bg-color); }
header { background-color: var(--header-bg-color); color: var(--header-text-color); }
.screen {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}
.screen.active { display: block; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.option-btn {
    transition: all 0.2s ease-in-out;
    background-color: var(--card-bg-color);
    border-color: var(--border-color);
}
.option-btn:hover {
     background-color: var(--option-bg-hover);
     border-color: var(--option-border-hover);
}
.option-btn.correct {
    background-color: #10B981 !important;
    color: white !important;
    border-color: #059669 !important;
    transform: scale(1.05);
}
.option-btn.incorrect {
    background-color: #EF4444 !important;
    color: white !important;
    border-color: #DC2626 !important;
}
.option-btn.disabled { pointer-events: none; }
#timer-progress { transition: width 0.5s linear; }
#answers-container .answer-item {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}
.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
}
.spinner-small {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
#explanation-text ul {
    list-style-position: inside;
    padding-right: 1rem;
    text-align: right;
}
#explanation-text li, #explanation-text p {
    margin-bottom: 0.75rem;
}
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
.arrow-icon { transition: transform 0.2s; }
details[open] .arrow-icon { transform: rotate(180deg); }

.topic-checkbox {
    appearance: none; -webkit-appearance: none; width: 1.25rem; height: 1.25rem;
    border: 2px solid var(--border-color); border-radius: 0.375rem;
    flex-shrink: 0; transition: all 0.2s ease-in-out; position: relative;
    display: inline-block; vertical-align: middle; margin-left: 0.5rem; cursor: pointer;
}
.topic-checkbox:checked { background-color: var(--primary-color); border-color: var(--primary-color); }
.topic-checkbox:checked::after {
    content: ''; position: absolute; left: 5px; top: 1px; width: 6px; height: 12px;
    border: solid white; border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.topic-checkbox:disabled { border-color: #4b5563; cursor: not-allowed; }
.topic-checkbox:disabled:checked { background-color: #9ca3af; border-color: #9ca3af; }

/* Leaderboard Styles */
.leaderboard-item {
    display: flex; align-items: center; padding: 0.75rem;
    border-radius: 0.5rem; transition: background-color 0.2s;
}
.leaderboard-item:nth-child(odd) { background-color: rgba(255,255,255,0.02); }
.leaderboard-rank { font-weight: bold; width: 2.5rem; text-align: center; }
.leaderboard-name { flex-grow: 1; font-weight: 600; }
.leaderboard-score { width: 4rem; text-align: center; }
.leaderboard-time { width: 5rem; text-align: center; color: var(--secondary-text-color); font-size: 0.9rem; }
.leaderboard-timestamp { width: 6rem; text-align: center; color: var(--secondary-text-color); font-size: 0.9rem;}
.rank-1 .fa-trophy { color: var(--gold-color); }
.rank-2 .fa-trophy { color: var(--silver-color); }
.rank-3 .fa-trophy { color: var(--bronze-color); }

.leaderboard-item.active,
.leaderboard-item.current-player,
.leaderboard-item.self {
    color: #f9fafb; /* Light text color */
}
.leaderboard-item.active .leaderboard-time,
.leaderboard-item.active .leaderboard-timestamp,
.leaderboard-item.current-player .leaderboard-time,
.leaderboard-item.current-player .leaderboard-timestamp,
.leaderboard-item.self .leaderboard-time,
.leaderboard-item.self .leaderboard-timestamp {
    color: #9ca3af; /* Lighter secondary text color */
}

/* Slider Styles */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 20px;
  width: 20px;
  background-color: var(--slider-thumb-bg);
  border-radius: 50%;
  border: none;
  margin-top: -7px;
}
input[type=range]::-moz-range-thumb {
  height: 20px;
  width: 20px;
  background-color: var(--slider-thumb-bg);
  border-radius: 50%;
  border: none;
}
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  background-color: var(--slider-track-bg);
  border-radius: 3px;
}
input[type=range]::-moz-range-track {
  width: 100%;
  height: 6px;
  background-color: var(--slider-track-bg);
  border-radius: 3px;
}

/* Styles for inputs and textareas */
input[type="text"],
input[type="number"],
textarea {
    background-color: var(--input-bg-color);
    color: var(--input-text-color);
    border-color: var(--input-border-color);
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

/* Placeholder styles */
::placeholder {
    color: var(--placeholder-color);
    opacity: 1;
}
:-ms-input-placeholder {
   color: var(--placeholder-color);
}
::-ms-input-placeholder {
   color: var(--placeholder-color);
}

/* Remove number input arrows */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

#manual-mode-container code {
    color: #f9fafb !important;
}

#ads-modal-content {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 1rem;
}
