/* style.css - Complete and Consolidated Styles - V2 */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&family=Bubblegum+Sans&family=Comic+Neue:wght@400;700&display=swap');

/* CSS Variables */
:root {
    /* Existing Variables */
    --header-height: 3.5rem; 
    --pink-primary: #ff69b4;
    --pink-secondary: #ff1493;
    --purple-primary: #8b4cb8; 
    --purple-secondary: #9370db; 
    --gold: #ffd700;
    --border-radius: 15px;
    --border-radius-large: 25px;
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 15px;
    --spacing-lg: 20px;
    --spacing-xl: 25px;

    /* Game Screen Theme Colors */
    --game-bg-start: #e8d5ff; 
    --game-bg-mid: #f0e6ff;   
    --game-bg-end: #ffeaa7;   
    --game-container-bg: rgba(255, 255, 255, 0.1);
    --game-container-border: rgba(255, 255, 255, 0.2);
    --game-clue-bg: rgba(255, 255, 255, 0.9);
    --game-clue-border: #ff69b4; 
    --game-clue-text-color: #6a1b9a;
    --game-main-title-color: #e91e63; 
    --game-letter-box-border: #ddd;
    --game-letter-box-bg: white;
    --game-letter-box-text: #333;
    --game-key-bg: #b39ddb; 
    --game-key-text: white;
    --game-home-button-bg: #ffd93d; 
    --game-home-button-border: #ffca28;
    --game-home-button-text: #8d6e00;
    --game-star-icon-color: #ff8f00;

    /* Home Screen General Theme Colors */
    --home-header-bg-start: #e91e63;
    --home-header-bg-end: #c2185b;
    --home-header-text: white;
    --home-header-border: #c2185b; 
    --home-section-bg: rgba(255, 255, 255, 0.9);
    --home-section-border-dash: #e91e63; 
    --home-section-border-solid: #e91e63; 
    --home-title-color: #e91e63; 

    /* --- Button Color Unification: Using Friends/Easy Purple Theme --- */
    --home-mode-solo-bg: var(--home-mode-friends-bg); /* Unified */
    --home-mode-solo-text: var(--home-mode-friends-text); /* Unified */
    --home-mode-solo-border: var(--home-mode-friends-border); /* Unified */
    
    --home-mode-friends-bg: #c5b3e6; 
    --home-mode-friends-text: white;
    --home-mode-friends-border: #a188d1; 

    --home-difficulty-border: #e91e63; /* This is for the container, not buttons */
    --home-difficulty-bg: white; /* This is for the container, not buttons */
    --home-difficulty-text: #e91e63; /* This is for the container, not buttons */

    --home-difficulty-easy-bg: #c5b3e6; /* Base purple for 'easy' */
    --home-difficulty-easy-text: white;
    --home-difficulty-easy-border: #a188d1;

    --home-difficulty-medium-bg: var(--home-difficulty-easy-bg); /* Unified */
    --home-difficulty-medium-text: var(--home-difficulty-easy-text); /* Unified */
    --home-difficulty-medium-border: var(--home-difficulty-easy-border); /* Unified */

    --home-difficulty-hard-bg: var(--home-difficulty-easy-bg); /* Unified */
    --home-difficulty-hard-text: var(--home-difficulty-easy-text); /* Unified */
    --home-difficulty-hard-border: var(--home-difficulty-easy-border); /* Unified */

    --home-start-button-bg: var(--home-difficulty-easy-bg); /* Unified */
    --home-start-button-text: var(--home-difficulty-easy-text); /* Unified */
    --home-start-button-border: var(--home-difficulty-easy-border); /* Unified */

    /* Network Setup Section Specific Colors */
    --network-form-label-color: #e91e63;
    --network-form-input-border-color: #e91e63;
    --network-form-input-focus-border-color: #c2185b;
    --network-form-input-focus-shadow-color: rgba(233, 30, 99, 0.3);
    --network-action-create-bg: var(--home-difficulty-easy-bg); /* Unified */
    --network-action-create-border: var(--home-difficulty-easy-border); /* Unified */
    --network-action-create-text: var(--home-difficulty-easy-text); /* Unified */
    
    --network-action-search-bg: var(--home-difficulty-easy-bg); /* Unified to purple */
    --network-action-search-border: var(--home-difficulty-easy-border); /* Unified to purple */
    --network-action-search-text: var(--home-difficulty-easy-text); /* Unified to purple's text color */

    /* New Lobby/Invite Screen Colors */
    --lobby-invite-section-border: #e91e63;
    --lobby-invite-title-color: #b39ddb;
    --lobby-qr-border-color: #b39ddb;
    --lobby-room-detail-bg: #f3e5f5;
    --lobby-room-detail-border: #b39ddb;
    --lobby-room-detail-text: #7b1fa2;
    --lobby-copy-button-bg: var(--home-difficulty-easy-bg); /* Unified */
    --lobby-copy-button-border: var(--home-difficulty-easy-border); /* Unified */
    --lobby-copy-button-text: var(--home-difficulty-easy-text); /* Unified */
    --lobby-copy-button-success-bg: #4caf50;
    --lobby-copy-button-success-border: #2e7d32;
    --lobby-waiting-section-border: #e91e63;
    --lobby-waiting-title-color: #b39ddb;
    --lobby-player-item-border: #e91e63;
    --lobby-player-status-ready-bg: #4caf50; /* Green for ready status is fine */
    
    /* Lobby Game Buttons - Unifying to purple */
    --lobby-game-button-not-ready-bg: var(--home-difficulty-easy-bg); /* Unified */
    --lobby-game-button-not-ready-border: var(--home-difficulty-easy-border); /* Unified */
    --lobby-game-button-ready-bg: var(--home-difficulty-easy-bg); /* Unified - for "Lista" */
    --lobby-game-button-ready-border: var(--home-difficulty-easy-border); /* Unified - for "Lista" */
    --lobby-game-button-start-bg: #4caf50; /* Keeping green for "Empezar Juego" as it's a primary action */
    --lobby-game-button-start-border: #2e7d32;
    
    --lobby-leave-button-bg: #f44336; /* Red for leave is fine */
    --lobby-leave-button-border: #d32f2f;
}

/* Reset and base styles */
*, *::before, *::after { 
    box-sizing: border-box; 
    margin: 0;
    padding: 0;
}
html { 
    height: 100%; 
}
body {
    font-family: 'Comic Sans MS', 'Fredoka', 'Bubblegum Sans', 'Comic Neue', cursive; 
    background: linear-gradient(135deg, var(--game-bg-start) 0%, var(--game-bg-mid) 50%, var(--game-bg-end) 100%);
    color: var(--purple-primary); 
    min-height: 100vh; 
    height: auto; 
    padding: 5px; 
    position: relative; 
    overflow-x: hidden; 
    overscroll-behavior-y: contain; 
    touch-action: manipulation;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
}

/* Decorative elements */
.decorative-star-bg { position: fixed; color: var(--gold); font-size: 20px; animation: twinkle 2s infinite; z-index: -1; }
.corner-decoration { position: fixed; font-size: 30px; animation: bounceHome 3s infinite; z-index: 100; }
.corner-decoration.top-left { top: 10px; left: 10px; }
.corner-decoration.top-right { top: 10px; right: 10px; }
@keyframes bounceHome { 0%, 100% { transform: translateY(0px) scale(1); } 50% { transform: translateY(-8px) scale(1.05); } }
@keyframes twinkle { 0%, 100% { opacity: 0.3; transform: scale(1); } 50% { opacity: 1; transform: scale(1.2); } }
.floating { animation: float 4s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-5px); } }
.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* Site Header (Original) */
#site-header { text-align: center; padding: 0 var(--spacing-md); width: 100%; transition: transform 0.3s ease-in-out; position: fixed; top: 0; left: 0; right: 0; height: var(--header-height); z-index: 1000; background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
body.playing #site-header { display: none; }
body:not(.playing) #site-header.hidden-by-home-header { display: none; }
#site-header h1 { font-family: 'Fredoka', 'Bubblegum Sans', cursive; background: linear-gradient(45deg, var(--pink-secondary), var(--pink-primary), #ffc0cb, var(--pink-secondary)); background-size: 300% 300%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: var(--pink-secondary); font-size: 1.8rem; font-weight: 700; margin: 0; text-shadow: 1px 1px 2px rgba(255, 105, 180, 0.2); animation: rainbow 3s ease-in-out infinite; position: relative; display: inline-block; }
@keyframes rainbow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
#site-header h1::before, #site-header h1::after { content: '✨'; position: absolute; top: 50%; transform: translateY(-50%); animation: sparkle 2s infinite; font-size: 0.7em; }
#site-header h1::before { left: -20px; } #site-header h1::after { right: -20px; animation-delay: 1s; }
@keyframes sparkle { 0%, 100% { transform: translateY(-50%) scale(1) rotate(0deg); opacity: 1; } 50% { transform: translateY(-50%) scale(1.3) rotate(180deg); opacity: 0.7; } }

/* Setup Container */
#setup-container { max-width: 400px; margin: 20px auto; padding: 10px; background: transparent; box-shadow: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 15px; position: relative; width: 100%; }
body.playing #setup-container { display: none; }

/* Home Screen Header */
.home-header { text-align: center; background: linear-gradient(45deg, var(--home-header-bg-start), var(--home-header-bg-end)); color: var(--home-header-text); padding: 12px 15px; border-radius: 20px; margin-bottom: 15px; box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3); border: 3px solid var(--home-header-border); width: 100%; }
.home-header h1 { font-size: 22px; font-weight: bold; text-shadow: 1px 1px 3px rgba(0,0,0,0.2); margin:0; font-family: 'Comic Sans MS', 'Fredoka', cursive; }

/* Home Game Mode Section */
.home-game-mode-section { background: var(--home-section-bg); border: 3px dashed var(--home-section-border-dash); border-radius: 20px; padding: 20px 15px; margin-bottom: 15px; text-align: center; position: relative; width: 100%; }
.home-section-decoration { display: flex; justify-content: center; gap: 12px; margin-bottom: 12px; font-size: 24px; }
.home-section-title { font-size: 18px; color: var(--home-title-color); font-weight: bold; margin-bottom: 18px; font-family: 'Comic Sans MS', 'Fredoka', cursive; }
.home-mode-buttons { 
    display: flex; 
    gap: 10px; 
    justify-content: center; 
    flex-wrap: nowrap;
    width: 100%; 
    max-width: calc(160px * 2 + 10px + 4px * 2 + 20px); /* Increased for padding */
    margin-left: auto;
    margin-right: auto;
    padding-left: 10px; /* Added padding */
    padding-right: 10px; /* Added padding */
}
.home-mode-button { padding: 12px 20px; border: none; border-radius: 25px; font-size: 15px; font-weight: bold; cursor: pointer; transition: all 0.3s; box-shadow: 0 3px 6px rgba(0,0,0,0.15); border: 2px solid transparent; font-family: 'Comic Sans MS', 'Fredoka', cursive; display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 160px; flex-shrink: 0; }
.home-mode-button.solo { background: var(--home-mode-solo-bg); color: var(--home-mode-solo-text); border-color: var(--home-mode-solo-border); }
.home-mode-button.friends { background: var(--home-mode-friends-bg); color: var(--home-mode-friends-text); border-color: var(--home-mode-friends-border); }
.home-mode-button:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 5px 10px rgba(0,0,0,0.2); }
.home-mode-button.selected-mode { transform: scale(1.05); box-shadow: 0 0 10px var(--gold), inset 0 0 5px rgba(0,0,0,0.1); }

/* Home Play Section (Solo & Network) */
.home-play-section { background: var(--home-section-bg); border: 3px solid var(--home-section-border-solid); border-radius: 20px; padding: 20px 15px; margin-bottom: 15px; text-align: center; width: 100%; display: flex; flex-direction: column; align-items: center;}
.home-play-title { font-size: 22px; color: var(--home-title-color); font-weight: bold; margin-bottom: 15px; font-family: 'Comic Sans MS', 'Fredoka', cursive; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* Styles specific to SOLO play section's difficulty */
.home-difficulty-title { font-size: 16px; color: var(--home-title-color); font-weight: bold; margin-bottom: 12px; font-family: 'Comic Sans MS', 'Fredoka', cursive; display: flex; align-items: center; justify-content: center; gap: 6px; }
.home-difficulty-buttons { 
    display: flex; 
    gap: 10px; 
    justify-content: center; 
    flex-wrap: nowrap;
    margin-bottom: 20px; 
    width: 100%; 
    max-width: calc(110px * 3 + 10px * 2 + 4px * 2 + 20px); /* Increased for padding */
    margin-left: auto;
    margin-right: auto;
    padding-left: 10px; /* Added padding */
    padding-right: 10px; /* Added padding */
}
.home-difficulty-button { padding: 10px 18px; border: 2px solid; border-radius: 25px; font-size: 14px; font-weight: bold; cursor: pointer; transition: all 0.3s; font-family: 'Comic Sans MS', 'Fredoka', cursive; display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 110px; flex-shrink: 0; }
.home-difficulty-button.easy { background: var(--home-difficulty-easy-bg); color: var(--home-difficulty-easy-text); border-color: var(--home-difficulty-easy-border); }
.home-difficulty-button.medium { background: var(--home-difficulty-medium-bg); color: var(--home-difficulty-medium-text); border-color: var(--home-difficulty-medium-border); }
.home-difficulty-button.hard { background: var(--home-difficulty-hard-bg); color: var(--home-difficulty-hard-text); border-color: var(--home-difficulty-hard-border); }
.home-difficulty-button:hover { transform: scale(1.05) translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.home-difficulty-button.selected { box-shadow: 0 0 12px var(--gold), inset 0 0 8px rgba(0,0,0,0.1); transform: scale(1.1); }
.home-difficulty-button.easy.selected { background: var(--home-difficulty-easy-bg); color: var(--home-difficulty-easy-text); border-color: var(--home-difficulty-easy-border); } /* Already purple */
.home-difficulty-button.medium.selected { background: var(--home-difficulty-medium-bg); color: var(--home-difficulty-medium-text); border-color: var(--home-difficulty-medium-border); } /* Will take unified purple */
.home-difficulty-button.hard.selected { background: var(--home-difficulty-hard-bg); color: var(--home-difficulty-hard-text); border-color: var(--home-difficulty-hard-border); } /* Will take unified purple */

/* Start Button for Home Screen */
.home-start-button { 
    background: var(--home-start-button-bg); 
    color: var(--home-start-button-text); 
    border: 3px solid var(--home-start-button-border); 
    border-radius: 30px; 
    padding: 10px 20px; 
    font-size: 16px; 
    font-weight: bold; 
    cursor: pointer; 
    transition: all 0.3s; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.2); 
    width: auto; 
    max-width: 200px; 
    font-family: 'Comic Sans MS', 'Fredoka', cursive; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    margin-left: auto; 
    margin-right: auto; 
}
.home-start-button:hover { background: var(--home-difficulty-easy-border); transform: translateY(-2px) scale(1.02); box-shadow: 0 6px 12px rgba(0,0,0,0.3); } /* Hover to slightly darker purple */

/* Styles for Network Setup section (within #network-game-setup-section) */
#network-game-setup-section.friends-section .form-group {
    margin-bottom: 15px; 
    text-align: left; 
    width:100%; 
    max-width: 320px; 
    margin-left: auto;
    margin-right: auto;
}
#network-game-setup-section.friends-section .form-label { 
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px; 
    color: var(--network-form-label-color); 
    font-weight: bold; 
    margin-bottom: 8px; 
    font-family: 'Comic Sans MS', 'Fredoka', cursive; 
}
#network-game-setup-section.friends-section .form-input, 
#network-game-setup-section.friends-section .form-select {
    width: 100%; 
    padding: 12px 15px;
    border: 3px solid var(--network-form-input-border-color);
    border-radius: 20px; 
    font-size: 16px;
    font-family: 'Comic Sans MS', 'Arial', sans-serif; 
    background: white; 
    color: #333;
    transition: all 0.3s;
}
#network-game-setup-section.friends-section .form-select { 
    cursor: pointer; 
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23e91e63' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
    padding-right: 40px; 
}
#network-game-setup-section.friends-section .form-input:focus, 
#network-game-setup-section.friends-section .form-select:focus {
    outline: none; 
    border-color: var(--network-form-input-focus-border-color);
    box-shadow: 0 0 10px var(--network-form-input-focus-shadow-color);
    transform: scale(1.02);
}
#network-game-setup-section .home-network-actions { 
    display: flex; 
    gap: 10px; 
    justify-content: center; 
    flex-wrap: wrap; 
    margin-top: 20px; 
    width: 100%;
}
#network-game-setup-section .home-network-actions .home-mode-button { 
    flex-grow: 1; 
    flex-basis: 140px; 
    max-width: 190px; 
}
#network-game-setup-section .home-network-actions .home-mode-button.create { 
    background: var(--network-action-create-bg);
    color: var(--network-action-create-text);
    border-color: var(--network-action-create-border);
}
#network-game-setup-section .home-network-actions .home-mode-button.search { 
    background: var(--network-action-search-bg);
    color: var(--network-action-search-text);
    border-color: var(--network-action-search-border);
}
/* Hover for .search button if it's purple now */
#network-game-setup-section .home-network-actions .home-mode-button.search:hover {
    background: var(--home-difficulty-easy-border); /* Darker purple on hover */
}


/* Home Screen Bottom Decoration and Footer */
.home-bottom-decoration { display: flex; justify-content: center; gap: 10px; margin: 15px 0; font-size: 22px; }
.home-footer { text-align: center; font-size: 18px; color: var(--home-title-color); font-weight: bold; margin-top: 15px; font-family: 'Comic Sans MS', 'Fredoka', cursive; }

/* New Lobby/Invite Screen Styles */
#network-invite-lobby-area { width: 100%; display: none; flex-direction: column; gap: 15px; }
.invite-section { background: var(--home-section-bg); border: 3px solid var(--lobby-invite-section-border); border-radius: 20px; padding: 20px; margin-bottom: 0; text-align: center; width: 100%; }
.invite-title { font-size: 20px; color: var(--lobby-invite-title-color); font-weight: bold; margin-bottom: 15px; font-family: 'Comic Sans MS', 'Fredoka', cursive; }
.qr-code { width: 128px; height: 128px; margin: 0 auto 15px; border: 3px solid var(--lobby-qr-border-color); border-radius: 10px; background: white; display: flex; align-items: center; justify-content: center; }
.qr-code canvas { display: block; }
.room-details { margin-bottom: 15px; font-size: 14px; color: #333; }
.room-details p { margin: 0; }
.room-details .room-id-display-inline, .room-details .room-link-display { display: block; background: var(--lobby-room-detail-bg); padding: 8px 12px; border-radius: 15px; margin: 8px 0; font-weight: bold; color: var(--lobby-room-detail-text); border: 2px solid var(--lobby-room-detail-border); word-break: break-all; }
.room-details .room-link-display { font-size: 13px; }
.copy-button { background: var(--lobby-copy-button-bg); color: var(--lobby-copy-button-text); border: none; border-radius: 20px; padding: 10px 20px; font-size: 16px; font-weight: bold; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 8px rgba(0,0,0,0.2); border: 3px solid var(--lobby-copy-button-border); font-family: 'Comic Sans MS', 'Fredoka', cursive; display: inline-flex; align-items: center; gap: 8px; }
.copy-button:hover { background: var(--home-difficulty-easy-border); transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.3); } /* Hover to darker purple */
.copy-button.copied { background: var(--lobby-copy-button-success-bg) !important; border-color: var(--lobby-copy-button-success-border) !important; }
.waiting-section { background: var(--home-section-bg); border: 3px solid var(--lobby-waiting-section-border); border-radius: 20px; padding: 20px; margin-bottom: 0; width: 100%; }
.waiting-title { font-size: 18px; color: var(--lobby-waiting-title-color); font-weight: bold; margin-bottom: 10px; text-align: center; font-family: 'Comic Sans MS', 'Fredoka', cursive; }
.waiting-title .room-id-display-inline { font-size: 0.8em; color: var(--lobby-room-detail-text); font-weight: normal; margin-left: 5px; }
.room-info { display: flex; justify-content: space-around; margin-bottom: 15px; font-size: 14px; color: #333; gap: 10px; flex-wrap: wrap; }
.room-info-item { background: var(--lobby-room-detail-bg); padding: 6px 12px; border-radius: 15px; border: 2px solid var(--lobby-room-detail-border); font-weight: bold; color: var(--lobby-room-detail-text); display: inline-flex; align-items: center; gap: 5px; }
.player-list { margin-bottom: 15px; }
.player-item { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 10px 15px; border-radius: 15px; margin-bottom: 8px; border: 2px solid var(--lobby-player-item-border); font-family: 'Comic Sans MS', 'Fredoka', cursive; }
.player-info { font-weight: bold; color: #333; font-size: 15px;}
.player-status { color: white; padding: 4px 12px; border-radius: 12px; font-size: 14px; font-weight: bold; }
.player-status.ready { background: var(--lobby-player-status-ready-bg); }
.player-status.not-ready { background: #ff8c00; } 
.player-status.disconnected { background: #757575; } 
#lobby-message-area { 
    text-align: center; 
    font-size: 16px; 
    color: var(--lobby-waiting-title-color); 
    font-weight: bold; 
    margin-bottom: 15px; /* Increased bottom margin */
    font-family: 'Comic Sans MS', 'Fredoka', cursive; 
}
.game-buttons { display: flex; gap: 10px; justify-content: center; margin-bottom: 15px; }
.game-button { padding: 10px 18px; border: none; border-radius: 20px; font-size: 14px; font-weight: bold; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 8px rgba(0,0,0,0.2); flex: 1; max-width: 160px; font-family: 'Comic Sans MS', 'Fredoka', cursive; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--home-difficulty-easy-text); /* Default text color for all game buttons */ }
.game-button.not-ready { background: var(--lobby-game-button-not-ready-bg); border: 3px solid var(--lobby-game-button-not-ready-border); }
.game-button.ready { background: var(--lobby-game-button-ready-bg); border: 3px solid var(--lobby-game-button-ready-border); } /* For "Lista" */
.game-button.start { background: var(--lobby-game-button-start-bg); border: 3px solid var(--lobby-game-button-start-border); } /* For "Empezar" - kept green */
.game-button:hover:not(.start) { background: var(--home-difficulty-easy-border); transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.3); } /* Hover to darker purple for non-start */
.game-button.start:hover { background: #2e7d32; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.3); } /* Hover for start button */
.game-button:disabled { opacity: 0.6; cursor: not-allowed; background: #ccc !important; border-color: #bbb !important; color: #666 !important; }
.leave-button { background: var(--lobby-leave-button-bg); color: white; border: 3px solid var(--lobby-leave-button-border); border-radius: 20px; padding: 12px 25px; font-size: 16px; font-weight: bold; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 8px rgba(0,0,0,0.2); width: 100%; max-width: 280px; margin: 0 auto 10px; display: flex; align-items: center; justify-content: center; gap: 8px; font-family: 'Comic Sans MS', 'Fredoka', cursive; }
.leave-button:hover { background: #d32f2f; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.3); }

/* Styles for game screen elements (#app and its children) */
#app { max-width: 400px; margin: 20px auto; background: var(--game-container-bg); border-radius: 20px; padding: 20px; backdrop-filter: blur(10px); border: 2px solid var(--game-container-border); flex: 1 1 auto; display: none; flex-direction: column; width: 100%; min-height: 500px; }
body.playing #app { display: flex !important; }
#stats-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 20px; padding: 10px 15px; font-size: 1em; background: rgba(255,255,255,0.05); border-radius: 15px;}
#stars-display-container, .stars-rating { display: flex; justify-content: center; gap: 8px; }
#stars-display { display: flex; gap: 2px; min-height: 24px; }
#stars-display .star-icon { font-size: 24px; color: var(--game-star-icon-color); }
#current-player-turn-display { color: var(--game-clue-text-color); font-weight: bold; font-size: 0.9em; text-align: right;}
#clue-display-area { background: var(--game-clue-bg); border: 3px solid var(--game-clue-border); border-radius: 20px; padding: 20px; margin-bottom: 20px; position: relative; overflow: visible; text-align: center; min-height: 60px; }
.clue-header { margin-bottom: 10px; font-weight: bold; color: var(--game-clue-text-color); font-size: 1.1em; }
.cloud-container { position: absolute; top: -30px; right: -30px; z-index: 10; cursor: pointer; }
.cloud { font-size: 60px; transition: transform 0.3s; filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.2)); display: block; }
.cloud:hover { transform: scale(1.1); }
.cloud-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 16px; font-weight: bold; color: var(--game-clue-text-color); pointer-events: none; text-shadow: 1px 1px 2px rgba(255,255,255,0.8);}
#clue-text { font-size: 18px; color: var(--game-clue-text-color); display: none; text-align: center; margin-top: 10px; clear: both; } 
#clue-text.visible { display: block; animation: fadeIn 0.5s; }
.speaker-btn.word-audio-speaker-btn { background-color: rgba(255, 255, 255, 0.9); border: 2px solid var(--game-clue-border, #ff69b4); border-radius: 50%; padding: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: transform 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.1); position: absolute; bottom: -15px; right: -15px; z-index: 11; }
.speaker-btn.word-audio-speaker-btn img { width: 30px; height: 30px; display:block; }
.speaker-btn.word-audio-speaker-btn:hover { transform: scale(1.1); }
.speaker-btn.word-audio-speaker-btn:disabled { opacity: 0.5; cursor: default; }
.main-title { text-align: center; font-size: 24px; color: var(--game-main-title-color); margin-bottom: 20px; text-shadow: 2px 2px 4px rgba(0,0,0,0.1); font-family: 'Comic Sans MS', 'Fredoka', cursive; }
#word-display-container { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; padding: 10px 0; min-height: 50px; }
.letter-box { width: 45px; height: 45px; border: 3px solid var(--game-letter-box-border); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; font-weight: bold; background: var(--game-letter-box-bg); color: var(--game-letter-box-text); transition: all 0.3s; text-transform: uppercase; font-family: 'Comic Sans MS', 'Fredoka', cursive; }
.letter-box.filled { background: #e1bee7; border-color: #9c27b0; transform: scale(1.05); color: var(--game-key-text); }
#alphabet-keyboard-container { display: grid; grid-template-rows: repeat(3, 1fr); gap: 6px; margin-bottom: 20px; padding: 10px; background: rgba(255,255,255,0.05); border-radius: 15px; min-height: 150px; }
.keyboard-row { display: flex; justify-content: center; gap: 4px; }
.keyboard-row:nth-child(2) { margin-left: 0.5em; margin-right: -0.5em; } 
.keyboard-row:nth-child(3) { margin-left: 1em; margin-right: -1em; } 
.key { min-width: 30px; height: 40px; background: var(--game-key-bg); border: none; border-radius: 6px; font-size: 14px; font-weight: bold; color: var(--game-key-text); cursor: pointer; transition: all 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.2); font-family: 'Comic Sans MS', 'Fredoka', cursive; padding: 5px; display: inline-flex; align-items: center; justify-content: center;}
.key:hover { background: #9575cd; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.3); }
.key:active { transform: translateY(0); }
.key.guessed { background: #757575; opacity: 0.7; }
.key:disabled { background: #a0a0a0; color: #e0e0e0; cursor: not-allowed; opacity: 0.5; box-shadow: none; transform: none;}
#message-area { text-align: center; font-size: 16px; margin: 15px 0; padding: 10px; border-radius: 10px; min-height: 1.5em; font-family: 'Comic Sans MS', 'Fredoka', cursive; font-weight: bold; display: block; }
#message-area:empty { display: none; } 
#message-area.win, #message-area.lose, #message-area.success, #message-area.error, #message-area.info { display: block !important; } 
#message-area.win { background: #c8e6c9; color: #2e7d32; border: 2px solid #4caf50; }
#message-area.lose { background: #ffcdd2; color: #c62828; border: 2px solid #f44336; }
.message.success { color: #228b22; background: linear-gradient(135deg, #90ee90, #98fb98); font-weight:bold; } 
.message.error { color: #dc143c; background: linear-gradient(135deg, #ffb6c1, #ffc0cb); font-weight:bold; }
.message.info { color: var(--purple-primary); background: linear-gradient(135deg, #dda0dd, #e6e6fa); font-weight:bold;}
#controls-section { display: flex; justify-content: center; margin-top: 10px; } 
.home-button, #main-menu-button, #play-again-button { background: var(--game-home-button-bg); border: 3px solid var(--game-home-button-border); border-radius: 25px; padding: 12px 25px; font-size: 16px; font-weight: bold; color: var(--game-home-button-text); cursor: pointer; width: auto; min-width: 180px; transition: all 0.3s; box-shadow: 0 4px 8px rgba(0,0,0,0.2); text-align: center; font-family: 'Comic Sans MS', 'Fredoka', cursive; margin: 5px; }
.home-button:hover, #main-menu-button:hover, #play-again-button:hover { background: #ffcc00; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.3); }
#score-display-section { margin-top: 15px; padding-top: 10px; border-top: 2px dashed var(--game-clue-border); }
#score-display-area { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--spacing-sm); }
.player-score-card { background: rgba(255,255,255,0.5); padding: 8px 12px; border-radius: 10px; font-size: 0.9em; border-left: 5px solid; box-shadow: 0 2px 8px rgba(0,0,0,0.1); font-weight: 600; color: var(--game-clue-text-color); }
.player-score-card .name {}
.player-score-card .score { font-weight: 700; color: var(--game-main-title-color); margin-left: 6px; font-size: 1.05em; }
#banner { margin-top: auto; padding-bottom: var(--spacing-sm); font-size: 0.9em; color: var(--purple-primary); font-weight: 500; text-align: center; flex-shrink: 0; width: 100%; }
body.playing #banner { display: none; } 
body:not(.playing) #banner { display: none; } 
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); backdrop-filter: blur(8px); align-items: center; justify-content: center; padding: var(--spacing-sm); }
.modal-content { background: linear-gradient(145deg, #ffffff 0%, #fdf6ff 100%); margin: auto; padding: var(--spacing-lg); border: 3px solid var(--pink-secondary); border-radius: var(--border-radius-large); width: 90%; max-width: 400px; position: relative; box-shadow: 0 10px 40px rgba(255, 20, 147, 0.5); text-align: center; max-height: 90vh; overflow-y: auto; font-family: 'Comic Sans MS', 'Fredoka', cursive; }
.modal-content::before { content: '💖🎀💖'; position: absolute; top: -18px; left: 50%; transform: translateX(-50%); background: #fff; padding: var(--spacing-xs) var(--spacing-md); border-radius: var(--border-radius); font-size: 1.3em; border: 2px solid var(--pink-secondary); }
.modal-content p, .modal-content h3 { font-size: 1.1em; color: var(--purple-primary); margin-bottom: var(--spacing-sm); font-weight: 600; }
.modal-content h3 { font-size: 1.4em; margin-top: var(--spacing-xs); color: var(--pink-secondary); }
.modal-buttons-container { display: flex; justify-content: center; gap: var(--spacing-sm); margin-top: var(--spacing-md); flex-wrap: wrap; }
.join-room-modal h3 { color: var(--pink-secondary); margin-bottom: var(--spacing-sm); }
.room-info { background: linear-gradient(135deg, #ffe0f0 0%, #f0e0ff 100%); padding: var(--spacing-xs); border-radius: var(--border-radius); margin-bottom: var(--spacing-sm); font-weight: 700; color: var(--purple-primary); }
.modal-form-inputs { text-align: left; margin: var(--spacing-sm) 0; }
.modal-form-inputs label { display: block; margin-bottom: 6px; font-size: 1em; color: var(--purple-primary); font-weight: 600; }
.modal-form-inputs input[type="text"], .modal-form-inputs select { width: 100%; padding: 8px var(--spacing-sm); background: linear-gradient(135deg, #ffffff 0%, #fef7ff 100%); border: 2px solid var(--pink-primary); border-radius: var(--border-radius); color: var(--purple-primary); font-size: 0.9em; font-family: 'Comic Sans MS', 'Fredoka', cursive; font-weight: 500; margin-bottom: var(--spacing-sm); transition: all 0.3s ease; }
.modal-form-inputs input:focus, .modal-form-inputs select:focus { outline: none; border-color: var(--pink-secondary); box-shadow: 0 0 8px rgba(255, 20, 147, 0.25); }
.modal-form-inputs input::placeholder { color: #c489d8; font-weight: 400; }
#network-info-area { }
#lobby-area { }
#lobby-player-list { margin-top: var(--spacing-md); display: flex; flex-direction: column; gap: var(--spacing-xs); }
.player-lobby-card { background: linear-gradient(145deg, #ffffff, #fef7ff); padding: var(--spacing-sm); border-radius: var(--border-radius); border-left: 4px solid; box-shadow: 0 2px 6px rgba(255, 105, 180, 0.15); display: flex; align-items: center; gap: var(--spacing-xs); font-weight: 600; }
.player-lobby-card .icon { font-size: 1.3em; min-width: 25px; text-align: center; }
.player-lobby-card .name { flex: 1; color: var(--purple-primary); font-weight: 700; font-size: 0.9em; }
.player-lobby-card .status { font-size: 0.8em; padding: 3px 6px; border-radius: 6px; font-weight: 600; }
.player-lobby-card .status.ready { background: var(--lobby-player-status-ready-bg); color: white; }
.player-lobby-card .status.not-ready { background: #ff8c00; color: white; } 
.player-lobby-card .status.disconnected { background: #757575; color: white; } 
#confetti-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1999; overflow: hidden; }
.confetti-piece { position: absolute; width: 8px; height: 8px; opacity: 0.8; animation: fall linear forwards; transform-origin: center center; }
#splash-screen { position:fixed; inset:0; z-index:9999; display:flex; align-items:center; justify-content:center; background:#fdf2f8; transition:opacity .5s ease;}
#splash-screen img { max-width: 80%; max-height: 80%; object-fit: contain; }
#splash-screen.fade-out { opacity:0; pointer-events:none; }
.action-button, .action-button-secondary, .action-button-danger, .action-button-confirm { font-family: 'Comic Sans MS', 'Fredoka', cursive; padding: 10px var(--spacing-lg); border: none; border-radius: var(--border-radius-large); font-size: 1.1em; font-weight: 600; cursor: pointer; transition: all 0.3s ease; margin: 6px; position: relative; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.12); min-width: 110px; text-align: center;}
.action-button { background: linear-gradient(145deg, var(--pink-primary), var(--pink-secondary)); color: white; }
.action-button:hover:not(:disabled) { background: linear-gradient(145deg, var(--pink-secondary), #dc143c); transform: translateY(-2px); box-shadow: 0 8px 25px rgba(255, 20, 147, 0.3); }
.action-button-confirm { background: linear-gradient(145deg, #32cd32, #228b22); color: white; }
.action-button-confirm:hover:not(:disabled) { background: linear-gradient(145deg, #228b22, #006400); transform: translateY(-2px);}
.action-button-danger { background: linear-gradient(145deg, #ff6347, #dc143c); color: white; }
.action-button-danger:hover:not(:disabled) { background: linear-gradient(145deg, #dc143c, #b22222); transform: translateY(-2px);}
.action-button-secondary { background: linear-gradient(145deg, var(--purple-secondary), #8a2be2); color: white; }
.action-button-secondary:hover:not(:disabled) { background: linear-gradient(145deg, #8a2be2, #7b68ee); transform: translateY(-2px);}
.action-button:disabled, .action-button-secondary:disabled, .action-button-danger:disabled, .action-button-confirm:disabled { opacity: 0.5; cursor: not-allowed; background: #cccccc; color: #666666; transform: none; box-shadow: none;}
#difficulty-selection-container { background: linear-gradient(135deg, #ffe0f0 0%, #f0e0ff 100%); padding: var(--spacing-md); border-radius: var(--border-radius); margin-bottom: var(--spacing-lg);}
#difficulty-selection-container p { font-size: 1.2em; color: var(--purple-primary); margin-bottom: var(--spacing-md); font-weight: 600; }
#difficulty-selection-container .difficulty-button { font-family: 'Comic Sans MS', 'Fredoka', cursive; background: linear-gradient(145deg, #ffffff, #f8f0ff); color: var(--purple-primary); border: 3px solid var(--pink-primary); border-radius: var(--spacing-lg); padding: 10px var(--spacing-lg); font-size: 1.1em; font-weight: 600; cursor: pointer; transition: all 0.3s ease; margin: var(--spacing-xs); position: relative; overflow: hidden; min-width: 80px;}
#difficulty-selection-container .difficulty-button:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(255, 105, 180, 0.4); }
#difficulty-selection-container .difficulty-button.active { background: linear-gradient(145deg, var(--pink-primary), var(--pink-secondary)); color: white; border-color: var(--gold); transform: scale(1.1); box-shadow: 0 0 20px rgba(255, 105, 180, 0.8);}
#difficulty-selection-container .difficulty-button.active::before { content: '🌟 '; }
#difficulty-selection-container .difficulty-button.active::after { content: ' 🌟'; }
#game-mode-selection-section { margin-bottom: var(--spacing-xl); background: linear-gradient(135deg, #ffeef8 0%, #f0e6ff 100%); padding: var(--spacing-lg); border-radius: var(--spacing-lg); border: 2px dashed var(--pink-primary); position: relative; width: 100%;}
#game-mode-selection-section::before { content: '🎮'; position: absolute; top: -15px; left: 50%; transform: translateX(-50%); background: #ffffff; padding: var(--spacing-xs) var(--spacing-sm); border-radius: var(--border-radius); font-size: 1.5em;}
#game-mode-selection-section p { font-size: 1.3em; color: var(--purple-primary); margin-bottom: var(--spacing-md); font-weight: 600;}
#game-mode-selection-section .tabs { display: flex; justify-content: center; gap: var(--spacing-md); margin-bottom: var(--spacing-lg); flex-wrap: wrap;}
#game-mode-selection-section .tab-button { font-family: 'Comic Sans MS', 'Fredoka', cursive; background: linear-gradient(145deg, var(--pink-primary), var(--pink-secondary)); color: white; border: none; border-radius: var(--border-radius-large); padding: 12px var(--spacing-lg); font-size: 1.1em; font-weight: 600; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(255, 105, 180, 0.4); position: relative; overflow: hidden; min-width: 120px;}
#game-mode-selection-section .tab-button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 105, 180, 0.6); }
#game-mode-selection-section .tab-button.active { background: linear-gradient(145deg, var(--gold), #ffb347); color: var(--purple-primary); transform: scale(1.05); box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);}
#game-mode-selection-section .tab-button.active::after { content: '👑'; position: absolute; top: -5px; right: -5px; font-size: 0.8em; }

/* Responsive adjustments */
@media (max-width: 640px) {
    :root { --header-height: 3rem; --spacing-xs: 3px; --spacing-sm: 5px; --spacing-md: 8px; --spacing-lg: 12px; --spacing-xl: 18px; }
    body { padding: 5px; } .corner-decoration { font-size: 24px; }
    #setup-container { padding: 8px; margin-top: 10px; margin-bottom:10px; max-width: 95%;}
    .home-header { padding: 12px; margin-bottom: 12px; border-radius:15px;} .home-header h1 { font-size: 20px; }
    .home-game-mode-section, .home-play-section { padding: 12px; border-radius:12px; }
    .invite-section, .waiting-section { padding: 12px; border-radius: 15px;} 
    .home-section-title { font-size: 16px; margin-bottom: 10px; } .home-play-title { font-size: 18px; }
    .invite-title, .waiting-title {font-size: 18px; margin-bottom: 10px;}
    
    .home-mode-buttons { max-width: 100%; flex-wrap: wrap; padding-left: 5px; padding-right: 5px;} 
    .home-mode-button { font-size: 13px; padding: 10px 12px; border-radius: 20px; min-width: 0; flex-basis: auto; flex-grow: 1; } 
    
    .home-difficulty-title { font-size: 14px; }
    .home-difficulty-buttons { max-width: 100%; flex-wrap: wrap; padding-left: 5px; padding-right: 5px;} 
    .home-difficulty-button { font-size: 13px; padding: 10px 12px; border-radius: 20px; min-width: 0; flex-basis: calc(33% - 7px); } 
    
    .home-start-button { font-size: 15px; padding: 10px 20px; border-radius: 25px; max-width: 180px;} 
    
    .home-network-actions .home-mode-button { padding: 12px 20px; font-size: 14px;} 
    .form-input, .form-select { padding: 10px 12px; font-size: 15px;} 
    .copy-button, .game-button, .leave-button { font-size: 14px; padding: 10px 15px;}
    .home-footer { font-size: 16px; }
    #app { margin: 10px auto; padding: 15px; max-width: 95%; }
    #stats-bar { flex-direction: column; padding: 8px; gap: 5px; margin-bottom: 15px; }
    #stars-display, .star-icon { font-size: 20px; } #current-player-turn-display { font-size: 0.85em; text-align: center; width:100%;}
    .clue-container { padding: 15px; margin-bottom: 15px; } .cloud { font-size: 50px; } .cloud-text { font-size: 14px; }
    .speaker-btn.word-audio-speaker-btn { padding: 6px; bottom: -12px; right: -12px;}
    .speaker-btn.word-audio-speaker-btn img { width: 26px; height: 26px;}
    .clue-text { font-size: 16px; } .main-title { font-size: 20px; margin-bottom: 15px; }
    .word-grid { gap: 6px; margin-bottom: 20px; } .letter-box { width: 40px; height: 40px; font-size: 20px; border-radius: 6px; }
    .keyboard { gap: 5px; margin-bottom: 15px; padding: 8px; } .keyboard-row { gap: 3px; }
    .key { min-width: 28px; height: 36px; font-size: 13px; border-radius: 5px; padding: 4px;}
    .home-button, #main-menu-button, #play-again-button { font-size: 15px; padding: 10px 20px; } .message { font-size: 15px; }
    body:not(.playing) #site-header { height: var(--header-height); padding: 0 var(--spacing-sm); }
    body:not(.playing) #site-header h1 { font-size: 1.5rem; }
    body:not(.playing) #site-header h1::before, body:not(.playing) #site-header h1::after { font-size: 0.6em; left: -12px; right: -12px; }
    .modal-content { padding: var(--spacing-md); width: 95%; max-height: 85vh; }
    .action-button, .action-button-secondary, .action-button-danger, .action-button-confirm {padding: 10px var(--spacing-md); font-size: 1em;} 
    #difficulty-selection-container .difficulty-button { padding: 8px var(--spacing-md); font-size: 1em;} 
    #game-mode-selection-section .tab-button { padding: 10px var(--spacing-md); font-size: 1em;} 
}

@media (max-width: 360px) {
    .corner-decoration { font-size: 20px; }
    .home-header h1 { font-size: 18px; } .home-section-title { font-size: 15px; } .home-play-title { font-size: 16px; }
    .invite-title, .waiting-title {font-size: 16px;}
    .home-mode-button { font-size: 12px; padding: 8px 10px; } 
    .home-difficulty-button { font-size: 12px; padding: 8px 10px; flex-basis: calc(33% - 6px); } 
    .home-start-button { font-size: 14px; padding: 10px 15px; max-width: 160px;} 
    .home-network-actions .home-mode-button { padding: 10px 15px; font-size: 13px;}
    .form-input, .form-select { padding: 9px 10px; font-size: 14px;} 
    .copy-button, .game-button, .leave-button { font-size: 13px; padding: 8px 12px;}
    .home-footer { font-size: 14px; }
    #app { margin: 8px auto; padding: 10px; } #stats-bar { padding: 6px; gap: 3px; }
    #stars-display, .star-icon { font-size: 18px; } #current-player-turn-display { font-size: 0.8em; }
    .clue-container { padding: 10px; } .cloud { font-size: 45px; top: -25px; right: -25px;} .cloud-text { font-size: 12px; }
    .speaker-btn.word-audio-speaker-btn { padding: 5px; bottom: -10px; right: -10px;}
    .speaker-btn.word-audio-speaker-btn img { width: 24px; height: 24px;}
    .clue-text { font-size: 14px; } .main-title { font-size: 18px; }
    .word-grid { gap: 4px; } .letter-box { width: 35px; height: 35px; font-size: 18px; }
    .keyboard { gap: 4px; padding: 5px; } .keyboard-row { gap: 2px; }
    .key { min-width: 24px; height: 32px; font-size: 12px; padding: 3px;}
    .home-button, #main-menu-button, #play-again-button { font-size: 14px; padding: 8px 15px; }
    body:not(.playing) #site-header { height: 2.8rem; } body:not(.playing) #site-header h1 { font-size: 1.3rem; }
    body:not(.playing) #site-header h1::before, body:not(.playing) #site-header h1::after { display: none; }
}