* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

body {
    background-color: #2c3e50;
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

header {
    margin-top: 20px;
    margin-bottom: 20px;
    text-align: center;
}

header h1 {
    font-size: 2.2rem;
    color: #f1c40f;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-container {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    justify-content: center;
    gap: 30px;
    background-color: transparent;
    padding: 15px;
    width: 80vw;
    /* Leaves 10vw on each side */
    max-width: none;
}

.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #34495e;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    flex-grow: 1;
    /* Allow the game area to expand to fill available space */
}

.sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: rgba(52, 73, 94, 0.8);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 480px;
}

.dp-header-img {
    width: 100%;
    min-width: 440px;
    max-width: 440px;
    height: auto;
    margin-bottom: 30px;
    border-radius: 5px;
}

.dev-text {
    text-align: center;
    font-size: 1.2rem;
    color: #ecf0f1;
    line-height: 1.8;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 8px;
    border-top: 3px solid #f1c40f;
    width: 100%;
}

.dev-text strong {
    color: #f1c40f;
    font-size: 1.2rem;
}

.ui-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #ecf0f1;
    padding: 0 10px;
}

.canvas-wrapper {
    position: relative;
    width: 800px;
    height: 600px;
    border: 4px solid #ecf0f1;
    border-radius: 5px;
    overflow: hidden;
    background-color: #bdc3c7;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(44, 62, 80, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    z-index: 10;
}

.overlay.hidden {
    display: none;
}

.overlay h2 {
    font-size: 2.5rem;
    color: #f1c40f;
    margin-bottom: 20px;
}

#victoryScreen h2 {
    color: #2ecc71;
}

.character-selection {
    margin-bottom: 25px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 10px;
}

.character-selection h3 {
    margin-bottom: 15px;
    color: #f1c40f;
}

.name-input {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 20px;
    font-size: 1.2rem;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    background-color: #ecf0f1;
    color: #2c3e50;
    text-align: right;
    outline: none;
    transition: border-color 0.3s;
}

.name-input:focus {
    border-color: #f1c40f;
}

.character-options {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.char-btn {
    background-color: #34495e;
    border: 3px solid transparent;
    font-size: 1.5rem;
    padding: 10px 30px;
}

.char-btn.selected {
    border-color: #2ecc71;
    background-color: #2c3e50;
    transform: scale(1.05);
}

.overlay p {
    font-size: 1.2rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

.overlay ul {
    list-style-position: inside;
    margin-bottom: 30px;
    text-align: right;
    font-size: 1.1rem;
}

.overlay ul li {
    margin-bottom: 10px;
}

.educational-tip {
    font-size: 1.3rem !important;
    font-weight: bold;
    color: #f1c40f;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 8px;
    border-right: 5px solid #f1c40f;
    margin-bottom: 30px;
    max-width: 90%;
}

button {
    padding: 15px 40px;
    font-size: 1.4rem;
    font-weight: bold;
    color: white;
    background-color: #2ecc71;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

button:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.4);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

#restartBtn {
    background-color: #e74c3c;
}

#restartBtn:hover {
    background-color: #c0392b;
}

/* Responsive adjustment */
@media (max-width: 850px) {
    .canvas-wrapper {
        width: 100%;
        max-width: 800px;
        height: auto;
        aspect-ratio: 4/3;
    }
}