body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #2c3e50;
    color: white;
    text-align: center;
    margin: 0;
    padding: 10px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.menu-content {
    background: rgba(0, 0, 0, 0.4);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 3px solid #f1c40f;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.menu-title {
    font-size: 60px;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    color: #f1c40f;
}

.menu-subtitle {
    font-size: 18px;
    font-weight: bold;
    color: #ecf0f1;
    margin-bottom: 30px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.main-btn {
    background: #f1c40f;
    color: #2c3e50;
    border: none;
    padding: 15px 40px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px #d4ac0d;
    transition: all 0.2s;
}

.main-btn:hover {
    background: #f4d03f;
    transform: translateY(-3px);
    box-shadow: 0 9px #d4ac0d;
}

.main-btn:active {
    transform: translateY(2px);
    box-shadow: 0 4px #d4ac0d;
}

.secondary-btn {
    background: transparent;
    color: white;
    border: 2px solid white;
    padding: 10px 25px;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: rgba(255,255,255,0.1);
}

.menu-lang {
    margin-top: 30px;
}

#lang-select {
    background: #34495e;
    color: white;
    border: 1px solid #7f8c8d;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
}

/* Modals */
.modal {
    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: 2000;
    transition: opacity 0.3s;
}

.modal-content {
    background: #34495e;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    border: 2px solid #f1c40f;
    text-align: left;
}

.close-btn {
    display: block;
    margin: 20px auto 0;
    padding: 10px 30px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.table {
    background-color: #27ae60;
    border: 8px solid #8e44ad;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    position: relative;
    box-sizing: border-box;
    margin: 10px auto;
    overflow: hidden; /* Prevent ball shadow leaks */
}

/* Tennis Ball Logic */
.tennis-ball {
    position: absolute;
    left: 40px; /* Spostata a sinistra per non coprire i tasti */
    font-size: 50px;
    z-index: 100;
    transition: top 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 15px 5px rgba(0,0,0,0.3));
    pointer-events: none;
    animation: ballBounce 0.6s infinite alternate ease-in-out;
}

.tennis-ball.pos-cpu {
    top: 50px;
}

.tennis-ball.pos-player {
    top: calc(100% - 150px);
}

@keyframes ballBounce {
    from { transform: translateY(0) scale(1.1); }
    to { transform: translateY(-10px) scale(1); }
}

.hand {
    height: 130px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.play-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    margin: 20px 0;
    position: relative;
    min-height: 200px;
}

#trick-area {
    display: flex;
    gap: 20px;
}

.card-container {
    width: 70px;
    height: 120px;
    margin: 0 5px;
    border-radius: 5px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    background-color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
}

.tennis-card {
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border: 2px solid #333;
    transition: transform 0.2s;
    color: #333;
}

.table-card {
    border: 4px solid #f1c40f !important;
    width: 120px !important;
    height: 180px !important;
}

.is-match {
    box-shadow: 0 0 15px #2ecc71;
    border-color: #2ecc71;
}

.is-miss {
    box-shadow: 0 0 15px #e74c3c;
    border-color: #e74c3c;
}

.symbols {
    display: flex;
    gap: 10px;
}

.action-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.action-btn {
    width: 80px;
    height: 120px;
    background: #f1c40f;
    border: 3px solid #d4ac0d;
    border-radius: 10px;
    font-size: 40px;
    font-weight: bold;
    color: #2c3e50;
    cursor: pointer;
    box-shadow: 0 6px #b7950b;
    transition: transform 0.1s;
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-5px);
}

.action-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.6;
}

.log-panel {
    width: 90%;
    max-width: 800px;
    background: #34495e;
    border-radius: 10px;
    margin: 10px auto;
    padding: 10px;
    text-align: left;
    height: 150px;
    display: flex;
    flex-direction: column;
}

#log-content {
    flex: 1;
    overflow-y: auto;
    font-family: monospace;
    font-size: 13px;
    color: #ecf0f1;
}

.fatigue-active-banner {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: 3px solid #f1c40f;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fatiguePulse 1.5s infinite alternate ease-in-out;
}

.fatigue-preview-banner {
    background: #34495e;
    border: 2px dashed #95a5a6;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    opacity: 0.9;
}

.fatigue-preview-banner .fatigue-title {
    color: #ecf0f1;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 2px;
}

.fatigue-preview-banner .fatigue-desc {
    color: #95a5a6;
    font-size: 12px;
    font-weight: bold;
}

.fatigue-title { font-weight: 900; color: #fff; }
.fatigue-desc { font-weight: bold; color: #ffd700; font-size: 13px; }

@keyframes fatiguePulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

.deck-info {
    font-weight: bold;
    background: rgba(0,0,0,0.3);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
}

.deck-info-bottom { margin-top: 10px; font-weight: bold; color: #bdc3c7; }

#score-board { font-size: 18px; font-weight: bold; margin-top: 10px; }

/* Screen Shake Effects */
@keyframes shake-low {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-5px, 0); }
    50% { transform: translate(5px, 0); }
    75% { transform: translate(-5px, 0); }
    100% { transform: translate(0, 0); }
}

@keyframes shake-medium {
    0% { transform: translate(0, 0); }
    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); }
}

@keyframes shake-high {
    0% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-10px, -10px) rotate(-5deg); }
    20% { transform: translate(10px, 10px) rotate(5deg); }
    30% { transform: translate(-10px, 10px) rotate(-5deg); }
    40% { transform: translate(10px, -10px) rotate(5deg); }
    50% { transform: translate(-10px, -10px) rotate(-5deg); }
    60% { transform: translate(10px, 10px) rotate(5deg); }
    70% { transform: translate(-10px, 10px) rotate(-5deg); }
    80% { transform: translate(10px, -10px) rotate(5deg); }
    90% { transform: translate(0, 0) rotate(0); }
    100% { transform: translate(0, 0) rotate(0); }
}

.shake-effect-low {
    animation: shake-low 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

.shake-effect-medium {
    animation: shake-medium 0.6s cubic-bezier(.36,.07,.19,.97) both;
}

.shake-effect-high {
    animation: shake-high 0.8s cubic-bezier(.36,.07,.19,.97) both;
    border-color: #e74c3c !important;
    box-shadow: 0 0 20px #e74c3c;
}
