body {
    margin: 0;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #2c3e50;
    user-select: none;
    color: white; /* Default text color to white */
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: block;
}

#ui-layer {
    position: absolute;
    top: 60px; /* Moved down from 20px */
    left: 20px;
    z-index: 2;
    background: rgba(0,0,0,0.7);
    padding: 20px;
    border-radius: 10px;
}

#player-hud {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 5;
    background: rgba(0,0,0,0.6);
    padding: 15px;
    border-radius: 10px;
    width: 250px;
    max-height: 40vh;
    overflow-y: auto;
    text-align: left;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
}

.completion-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    color: #f1c40f;
    text-shadow: 0 0 20px #e67e22;
    display: none;
    pointer-events: none;
    z-index: 1000;
    font-weight: bold;
    text-align: center;
    width: 100%;
}

#join-info {
    color: white;
    text-align: center;
}

#join-info h2 {
    margin: 0 0 10px 0;
    font-size: 1.5rem;
}

#qr-container {
    background: white;
    padding: 10px;
    border-radius: 5px;
    display: inline-block;
    margin-bottom: 10px;
}

#qr-image {
    width: 150px;
    height: 150px;
    display: block;
}

.btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    font-weight: bold;
}

.btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.3);
}

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

#player-list {
    color: white;
    margin-top: 10px;
}

/* Controller specific */
.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

#login-screen input {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 10px;
    text-align: center;
    font-size: 2.5rem;
    padding: 20px;
    width: 90%;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

#login-screen input:focus {
    outline: none;
    border-color: #3498db;
    background: rgba(255,255,255,0.2);
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.5);
}

#join-btn {
    font-size: 2rem;
    padding: 20px 40px;
    width: 90%;
    margin-top: 20px;
}

#login-screen input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.swing-area {
    width: 180px;
    height: 180px;
    background: radial-gradient(circle at 30% 30%, #e74c3c, #c0392b);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px auto;
    user-select: none;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3), inset 0 5px 15px rgba(255,255,255,0.2);
    border: 4px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: transform 0.1s;
    text-align: center; /* Ensure text alignment is center */
}

.swing-area h3 {
    font-size: 2rem;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    line-height: 1; /* Reset line-height to avoid offset */
    width: 100%; /* Ensure full width for centering */
}

.swing-area:active {
    transform: scale(0.95);
}

.controls-area {
    background: rgba(0,0,0,0.2);
    padding: 20px;
    border-radius: 15px;
    width: 100%;
    box-sizing: border-box;
}

.turn-overlay {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px 40px;
    border-radius: 50px;
    border: 3px solid #3498db;
    display: none;
    z-index: 1500;
    box-shadow: 0 0 30px #3498db;
    animation: slideDown 0.5s ease-out;
}

.turn-overlay h1 {
    margin: 0;
    color: white;
    font-size: 2.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

@keyframes slideDown {
    from { top: -100px; opacity: 0; }
    to { top: 20%; opacity: 1; }
}

.player-list-item {
    transition: all 0.3s;
    padding: 5px;
    border-radius: 5px;
    margin-bottom: 5px;
}

.active-turn {
    background-color: rgba(46, 204, 113, 0.4) !important;
    border: 2px solid #2ecc71;
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.5);
    animation: flash 1.5s infinite alternate;
}

@keyframes flash {
    from { background-color: rgba(46, 204, 113, 0.4); box-shadow: 0 0 10px #2ecc71; }
    to { background-color: rgba(46, 204, 113, 0.8); box-shadow: 0 0 20px #2ecc71; }
}

.text-flash {
    font-weight: bold;
    font-family: 'Arial Black', sans-serif; /* Make it thick */
    color: #39ff14; /* Neon Green Base */
    animation: textFlash 1s infinite alternate;
}

@keyframes textFlash {
    from { 
        opacity: 0.9;
        text-shadow: 0 0 2px #39ff14;
    }
    to { 
        opacity: 1; 
        text-shadow: 0 0 5px #39ff14, 0 0 10px #2ecc71; 
    }
}

.course-complete-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    color: white;
}

.course-complete-overlay h1 {
    font-size: 4rem;
    color: #f1c40f;
    text-shadow: 0 0 20px #e67e22;
    margin-bottom: 30px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#final-scores {
    font-size: 1.5rem;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    max-height: 60vh;
    overflow-y: auto;
    width: 90%;
    max-width: 500px;
    border: 1px solid rgba(255,255,255,0.2);
}

#final-scores div {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#footer-credits {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    z-index: 10;
    text-shadow: 1px 1px 2px black;
    pointer-events: none;
    width: 100%;
    text-align: center;
}

#restart-btn {
    width: auto;
    padding: 15px 50px;
    font-size: 1.5rem;
    min-width: 200px;
}

/* Landing Page Styles */
.landing-page {
    overflow-y: auto;
    height: 100vh;
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    display: flex;
    flex-direction: column;
}

.landing-header {
    text-align: center;
    padding: 60px 20px;
    background: radial-gradient(circle at center, rgba(52, 152, 219, 0.2) 0%, transparent 70%);
}

.landing-title {
    font-size: 5rem;
    margin: 0;
    color: #3498db;
    text-shadow: 0 0 20px rgba(52, 152, 219, 0.5);
    letter-spacing: -2px;
}

.landing-subtitle {
    font-size: 1.5rem;
    color: #bdc3c7;
    margin-top: 10px;
    margin-bottom: 40px;
    font-weight: 300;
}

.landing-buttons {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.landing-btn-link {
    text-decoration: none;
}

.landing-btn {
    padding: 20px 40px;
    font-size: 1.5rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-host {
    background: linear-gradient(to right, #2ecc71, #27ae60);
    color: white;
}

.btn-host:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(46, 204, 113, 0.4);
}

.btn-join {
    background: linear-gradient(to right, #3498db, #2980b9);
    color: white;
}

.btn-join:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(52, 152, 219, 0.4);
}

.landing-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    flex-grow: 1;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: white;
    margin-bottom: 40px;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 20%;
    width: 60%;
    height: 3px;
    background: #e67e22;
    border-radius: 2px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 80px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.1);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    display: block;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin: 10px 0;
    color: #f1c40f;
}

.feature-card p {
    color: #bdc3c7;
    line-height: 1.6;
}

.how-to-play {
    background: rgba(0, 0, 0, 0.2);
    padding: 40px;
    border-radius: 20px;
    margin-bottom: 60px;
}

.steps-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.step {
    text-align: center;
    flex: 1;
    min-width: 200px;
}

.step-number {
    background: #e67e22;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 auto 15px;
}

.step h4 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.step p {
    color: #bdc3c7;
    font-size: 0.9rem;
}

.landing-footer {
    text-align: center;
    padding: 40px;
    background: rgba(0, 0, 0, 0.3);
    color: #7f8c8d;
    margin-top: auto;
}

.credits-grid {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.credit-item h5 {
    color: white;
    margin: 0 0 5px;
    font-size: 1rem;
}

.credit-item p {
    margin: 0;
    font-size: 0.9rem;
}
