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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: #fff;
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s;
}

.nav-logo:hover {
    color: #764ba2;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 5px;
}

.nav-link:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.nav-link.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.15);
}

.game-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    margin: 2rem auto;
    max-width: 95%;
    display: flex;
    gap: 0;
}

.sidebar {
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: 15px 0 0 15px;
    min-width: 250px;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar h1 {
    font-size: 1.8em;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    text-align: center;
}

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

.stat-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 12px 15px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.1em;
    text-align: center;
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-area {
    flex: 1;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

button, select {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 35px;
}

select option {
    background: #764ba2;
    color: white;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

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

.color-picker-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(255, 255, 255, 0.2);
    padding: 12px 15px;
    border-radius: 5px;
}

.color-picker-container label {
    font-size: 0.9em;
    font-weight: 600;
    color: white;
}

.color-picker-container input[type="color"] {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.canvas-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 20px;
}

#game-canvas {
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.footer {
    text-align: center;
    font-size: 0.85em;
    opacity: 0.8;
    margin-top: auto;
}

.footer .attribution {
    font-size: 0.85em;
    margin-top: 5px;
    opacity: 0.7;
}

.footer .attribution a {
    color: #fff;
    text-decoration: none;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.5);
    transition: opacity 0.2s;
}

.footer .attribution a:hover {
    opacity: 1;
    border-bottom-color: #fff;
}

/* Victory message */
.victory-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.victory-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.5s ease-out;
}

.victory-message h2 {
    font-size: 3em;
    margin-bottom: 20px;
}

.victory-message button {
    margin-top: 20px;
    font-size: 1.2em;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Score submission form */
.score-submit {
    margin: 20px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.score-submit p {
    margin-bottom: 10px;
}

#player-name {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1em;
}

#player-name:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
}

#player-name::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#submit-message {
    margin-top: 10px;
    min-height: 20px;
    font-weight: bold;
}

/* Leaderboard display */
.leaderboard-display {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.layout-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.layout-tab {
    flex: 1;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
}

.layout-tab.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.leaderboard-table th {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.leaderboard-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-table tr:hover {
    background: rgba(255, 255, 255, 0.1);
}

.leaderboard-table tr:nth-child(1) td:first-child {
    color: #ffd700;
    font-weight: bold;
    font-size: 1.2em;
}

.leaderboard-table tr:nth-child(2) td:first-child {
    color: #c0c0c0;
    font-weight: bold;
}

.leaderboard-table tr:nth-child(3) td:first-child {
    color: #cd7f32;
    font-weight: bold;
}

#leaderboard-content {
    min-height: 200px;
}
