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

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
}

header {
    padding: 20px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    width: 100%;
}

.game-area {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 1400px;
    justify-content: center;
}

#board, #graph {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    max-height: 80vh;  /* Increased from 60vh to 80vh for more height */
}

#board {
    flex: 1;
    max-width: 67.5%;  /* Increased from 45% to 67.5% (1.5x) */
}

#graph {
    flex: 1;
    max-width: 67.5%;  /* Increased from 45% to 67.5% (1.5x) */
    display: none;  /* Initially hidden */
}

/* When graph is visible, make each canvas 50% of screen width */
.game-area.graph-visible #board,
.game-area.graph-visible #graph {
    display: block;
    flex: 1;
    max-width: 50%;  /* Each canvas takes 50% of screen width */
    width: 50%;
}

/* When graph is hidden, don't use flex for board to preserve aspect ratio */
.game-area:not(.graph-visible) {
    justify-content: center;
}

.game-area:not(.graph-visible) #board {
    flex: none;  /* Remove flex stretching */
    margin: 0 auto;
    width: auto;  /* Let canvas maintain its natural size */
    height: auto;
    max-width: 100%;  /* Can use full width when alone */
}

.controls {
    margin-top: 30px;
    display: flex;
    gap: 20px;
}

button {
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

button:active {
    transform: translateY(0);
}

footer {
    padding: 30px;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    width: 100%;
    font-size: 0.7em;  /* 0.7x smaller font size */
}

footer p {
    margin: 5px 0;  /* Reduced margin from 10px to 5px */
    line-height: 1.3;  /* Reduced line height */
}

footer a {
    color: #ffd700;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #ffed4e;
    text-decoration: underline;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .controls {
        flex-direction: row;  /* Keep buttons horizontal */
        gap: 10px;  /* Reduced gap for mobile */
        justify-content: center;
    }
    
    button {
        width: auto;  /* Auto width instead of fixed 200px */
        padding: 6px 8px;  /* Smaller padding for mobile to fit 5 buttons */
        font-size: 0.8em;  /* Smaller font size */
        min-width: 45px;  /* Minimum width to ensure readability */
        flex: 1;  /* Equal width distribution */
        max-width: 70px;  /* Maximum width to keep them small */
    }
}