:root {
    --primary-bg: #f2f2f2; /* DGA Primary Gray */
    --secondary-bg: #ffffff; /* DGA White */
    --accent-color: #00416B; /* DGA Primary Blue */
    --highlight-color: #00416B; /* DGA Primary Blue */
    --text-color: #333333; /* DGA Primary Dark Gray */
    --font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --p1-color: #00416B; /* DGA Primary Blue */
    --p2-color: #00B050; /* DGA Primary Green */
    --error-color: #FF0000;
    --success-color: #00B050;
}
body {
    background-color: var(--primary-bg);
    color: var(--text-color);
    font-family: var(--font-family);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
}
.container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    background-color: var(--secondary-bg);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
button {
    background-color: var(--highlight-color);
    color: white;
    border: none;
    padding: 12px 28px;
    font-size: 18px;
    font-family: var(--font-family);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}
button:hover {
    background-color: #005a8d; /* Darker blue */
    transform: scale(1.02);
}
.hidden { display: none !important; }

#host-view h1 { font-size: 2.5rem; color: var(--accent-color); }
#qr-code { margin: 20px auto; padding: 10px; background: white; width: fit-content; border-radius: 8px; }
.game-status { font-size: 1.2rem; margin-bottom: 20px; }
.question-area { margin: 30px 0; }
.question-text { font-size: 2rem; font-weight: bold; color: var(--accent-color)}
.timer { font-size: 2.5rem; color: var(--accent-color); margin: 10px 0; }
.answers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 20px;
}
.answer-slot {
    background: #e0f2f7; /* DGA Secondary Blue */
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 15px;
    min-height: 20px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-weight: bold;
    transition: background-color 0.4s, color 0.4s;
}
.answer-slot.found { color: white; }
.answer-slot.found-p1 { background-color: var(--p1-color); }
.answer-slot.found-p2 { background-color: var(--p2-color); }

.letter-box {
    border: 1px solid #ccc;
    min-width: 25px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    margin: 0 2px;
    border-radius: 4px;
    background-color: white;
}
.answer-slot.found .letter-box {
    background-color: transparent;
    border-color: transparent;
    min-width: auto;
}
.letter-box.connects::after {
    content: 'ـ';
    margin-left: -2px;
    margin-right: -2px;
}

.scores { display: flex; justify-content: space-around; font-size: 1.5rem; margin-top: 20px; }
.score-display, .wins-display { padding: 10px 20px; border-radius: 8px; color: white; }

#p1-wins, #p1-score { background-color: var(--p1-color); }
#p2-wins, #p2-score { background-color: var(--p2-color); }

.message-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 65, 107, 0.9); /* DGA Primary Blue with opacity */
    display: flex; justify-content: center; align-items: center;
    font-size: 3rem; color: white; z-index: 100;
}

#player-view h1, #player-name-prompt h1 { font-size: 1.8rem; color: var(--accent-color)}
#player-view p { font-size: 1.2rem; }
#answer-form, #name-form { display: flex; flex-direction: column; gap: 15px; margin-top: 20px; }
#answer-input, #name-input {
    padding: 15px; font-size: 18px; border-radius: 6px; 
    border: 2px solid #ddd;
    background: #fff; color: #333;
    font-family: var(--font-family);
    text-align: right;
}
#answer-input:focus, #name-input:focus { 
    outline: none; 
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 65, 107, 0.2);
}
.shake { animation: shake 0.5s; }
@keyframes shake {
    10%, 90% { transform: translate3d(1px, 0, 0); }
    20%, 80% { transform: translate3d(-2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(4px, 0, 0); }
    40%, 60% { transform: translate3d(-4px, 0, 0); }
}
#feedback { min-height: 24px; font-size: 1.2rem; font-weight: bold; }
.feedback-correct { color: var(--success-color); }
.feedback-wrong { color: var(--error-color); }

/* Star Wins Display */
.star-wins-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    direction: ltr; /* Ensure stars are laid out LTR regardless of page direction */
}
.team-stars {
    display: flex;
    align-items: center;
    gap: 10px;
}
.team-name {
    font-size: 1.8rem;
    font-weight: bold;
}
#team-1-stars {
    flex-direction: row-reverse;
}
#team-1-name {
    color: var(--p1-color);
}
#team-2-stars {
    flex-direction: row;
}
#team-2-name {
    color: var(--p2-color);
}

.star {
    width: 40px;
    height: 40px;
    background-color: #ccc; /* Empty star color */
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279L12 18.896l-7.416 4.517 1.48-8.279L0 9.306l8.332-1.151z'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279L12 18.896l-7.416 4.517 1.48-8.279L0 9.306l8.332-1.151z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    transition: background-color 0.3s, transform 0.3s;
}
.star.big-star {
    width: 60px;
    height: 60px;
}
.star.filled.team-1 {
    background-color: var(--p1-color);
    transform: scale(1.1);
}
.star.filled.team-2 {
    background-color: var(--p2-color);
    transform: scale(1.1);
}

button.secondary-btn {
    background-color: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    margin-top: 10px;
}
button.secondary-btn:hover {
    background-color: var(--accent-color);
    color: white;
}

