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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, hsl(229, 76%, 66%) 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.screen.active {
    display: flex;
}

#menu-screen, #lobby-screen, #gameover-screen {
    text-align: center;
}

.mode-description {
    color: white;
    font-size: 1.1em;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 10px;
}

h1 {
    color: white;
    font-size: 3em;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

h2 {
    color: white;
    font-size: 2em;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.player-count-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.player-count-btn {
    padding: 20px 30px;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid white;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.player-count-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.player-count-btn:active {
    transform: translateY(0);
}

.difficulty-buttons {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.difficulty-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 30px 25px;
    font-size: 1em;
    font-weight: bold;
    color: white;
    border: 3px solid white;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-width: 180px;
}

.difficulty-btn[data-difficulty="easy"] {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.difficulty-btn[data-difficulty="medium"] {
    background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
}

.difficulty-btn[data-difficulty="hard"] {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
}

.difficulty-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}

.difficulty-btn:active {
    transform: translateY(0);
}

.difficulty-icon {
    font-size: 2.5em;
}

.difficulty-name {
    font-size: 1.3em;
    margin-top: 5px;
}

.difficulty-desc {
    font-size: 0.9em;
    opacity: 0.9;
    font-weight: normal;
}

.control-buttons {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 30px 25px;
    font-size: 1em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid white;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-width: 180px;
}

.control-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.control-btn:active {
    transform: translateY(0);
}

.control-icon {
    font-size: 3em;
}

.control-name {
    font-size: 1.3em;
    margin-top: 5px;
}

.control-desc {
    font-size: 0.9em;
    opacity: 0.9;
    font-weight: normal;
}

.menu-btn {
    padding: 15px 40px;
    font-size: 1.3em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #2193b0 0%, #1a6fc4 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.menu-btn:active {
    transform: translateY(0);
}

.menu-btn.small {
    padding: 10px 25px;
    font-size: 1em;
    margin-top: 15px;
}

#connection-status, #lobby-status {
    color: white;
    margin-top: 20px;
    font-size: 1.1em;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    min-width: 300px;
}

#game-screen {
    position: relative;
}

.mute-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    font-size: 1.5em;
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid #764ba2;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 9999;
}

.mute-btn:hover {
    transform: scale(1.1);
    background: white;
}

.mute-btn:active {
    transform: scale(0.95);
}

#game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 1200px;
    margin-bottom: 10px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px 10px 0 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.quit-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.quit-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.quit-btn:active {
    transform: scale(0.97);
}

.score-panel {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.player-label {
    font-weight: bold;
    font-size: 0.9em;
}

.score {
    font-size: 1.8em;
    font-weight: bold;
    color: #764ba2;
}

#game-timer {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
}

#gameCanvas {
    border: 4px solid white;
    border-radius: 0 0 10px 10px;
    background: #2a2a2a;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: block;
}

#game-controls {
    margin-top: 15px;
    color: white;
    text-align: center;
    font-size: 0.9em;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 10px;
}

#game-controls p {
    margin: 5px 0;
}

#winner-text {
    font-size: 3.5em;
    margin-bottom: 30px;
}

#final-scores {
    color: white;
    font-size: 1.5em;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px 40px;
    border-radius: 10px;
}

#final-scores p {
    margin: 10px 0;
}

.points-earned {
    color: white;
    font-size: 1.3em;
    margin: 15px 0 25px;
    background: rgba(255, 255, 255, 0.15);
    padding: 15px 30px;
    border-radius: 12px;
    text-align: center;
    line-height: 1.8;
}

.points-label {
    font-weight: bold;
    font-size: 1.1em;
}

.points-value {
    color: #ffd700;
    font-weight: bold;
}

/* ── Menu fruit points display ── */
#menu-fruit-points {
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 20px;
    border-radius: 20px;
    margin-bottom: 25px;
}

/* ── Shop screen ── */
#shop-balance {
    color: #ffd700;
    font-size: 1.4em;
    font-weight: bold;
    margin-bottom: 10px;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    max-width: 820px;
    margin: 15px 0 20px;
    max-height: 380px;
    overflow-y: auto;
    padding: 5px;
}

.shop-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 14px;
    padding: 14px 10px;
    transition: transform 0.2s, border-color 0.2s;
}

.shop-item:hover {
    transform: translateY(-2px);
}

.shop-item.selected {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.15);
}

.color-preview {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.6);
    flex-shrink: 0;
}

.rainbow-preview {
    background: linear-gradient(135deg, #ff0000, #ff7700, #ffff00, #00ff00, #0000ff, #8b00ff);
}

.color-name {
    color: white;
    font-size: 0.8em;
    font-weight: bold;
    text-align: center;
}

.shop-btn {
    padding: 6px 12px;
    font-size: 0.8em;
    font-weight: bold;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
}

.buy-btn {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.buy-btn:hover {
    transform: scale(1.05);
}

.cant-afford {
    opacity: 0.4;
    cursor: not-allowed;
}

.equip-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.equip-btn:hover {
    transform: scale(1.05);
}

.equipped-btn {
    background: rgba(255, 215, 0, 0.3);
    color: #ffd700;
    cursor: default;
}

.shop-btn-menu {
    background: linear-gradient(135deg, #f5576c 0%, #c0392b 100%) !important;
    color: white !important;
}
