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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #121213;
    color: #ffffff;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    overflow-x: hidden;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.hidden {
    display: none !important;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5rem;
    margin: 0;
    color: #ffffff;
}

.header-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

/* Header Chat Styles */
.header-chat {
    margin-bottom: 20px;
}

.chat-mini {
    background-color: #1a1a1b;
    border: 1px solid #3a3a3c;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

.chat-mini:hover {
    background-color: #2a2a2b;
}

.chat-mini-messages {
    max-height: 60px;
    overflow: hidden;
    margin-bottom: 5px;
}

.chat-mini .chat-message {
    margin-bottom: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1.3;
}

.chat-mini .chat-message.system {
    background-color: transparent;
    color: #888;
    font-style: italic;
    text-align: center;
}

.chat-mini .chat-message.player1 {
    background-color: #538d4e;
    color: #ffffff;
    margin-right: 20%;
}

.chat-mini .chat-message.player2 {
    background-color: #b59f3b;
    color: #ffffff;
    margin-left: 20%;
}

.chat-expand-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.chat-expand-btn:hover {
    background-color: #3a3a3c;
}

.chat-expand-btn.has-new-message {
    animation: pulse 2s infinite;
}

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

/* Settings Menu Styles */
.settings-container {
    position: relative;
}

.settings-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    color: #ffffff;
}

.settings-icon:hover {
    background-color: #3a3a3c;
}

.settings-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #1a1a1b;
    border: 1px solid #3a3a3c;
    border-radius: 8px;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.3s ease;
}

.settings-menu.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.settings-option {
    width: 100%;
    background: none;
    border: none;
    padding: 12px 16px;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    text-align: left;
}

.settings-option:first-child {
    border-radius: 8px 8px 0 0;
}

.settings-option:last-child {
    border-radius: 0 0 8px 8px;
}

.settings-option:hover {
    background-color: #3a3a3c;
}

.settings-option:active {
    background-color: #538d4e;
}

.settings-divider {
    height: 1px;
    background-color: #3a3a3c;
    margin: 4px 0;
}

#leave-game {
    color: #ff6b6b;
}

#leave-game:hover {
    background-color: #dc3545;
    color: #ffffff;
}

.game-board {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.grid {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    width: 300px;
    height: 360px;
}

.cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    border: 2px solid #3a3a3c;
    background-color: #121213;
    color: #ffffff;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.cell.filled {
    border-color: #565758;
    background-color: #3a3a3c;
}

.cell.correct {
    background-color: #538d4e;
    border-color: #538d4e;
}

.cell.present {
    background-color: #b59f3b;
    border-color: #b59f3b;
}

.cell.absent {
    background-color: #3a3a3c;
    border-color: #3a3a3c;
}

.cell.typing-preview {
    background-color: #2a2a2b;
    border-color: #4a4a4c;
    animation: typing-pulse 1s infinite;
    opacity: 0.7;
}

@keyframes typing-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Inactivity Warning Modal */
.inactivity-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

.inactivity-warning-modal {
    background-color: #1a1a1b;
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

.inactivity-warning-modal h2 {
    color: #f59e0b;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.inactivity-warning-modal p {
    color: #ffffff;
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.inactivity-warning-modal #countdown {
    color: #f59e0b;
    font-weight: bold;
    font-size: 1.3rem;
}

/* Disconnect Modal */
.disconnect-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.disconnect-modal {
    background-color: #1a1a1b;
    border: 2px solid #ef4444;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.disconnect-modal h2 {
    color: #ef4444;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.disconnect-modal p {
    color: #ffffff;
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.disconnect-modal button {
    margin: 5px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.input-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

#guess-input {
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid #3a3a3c;
    border-radius: 8px;
    background-color: #121213;
    color: #ffffff;
    width: 200px;
    text-transform: uppercase;
}

#guess-input:focus {
    outline: none;
    border-color: #538d4e;
}

#guess-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#submit-guess {
    padding: 12px 20px;
    font-size: 1rem;
    background-color: #538d4e;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#submit-guess:hover:not(:disabled) {
    background-color: #6aaa64;
}

#submit-guess:disabled {
    background-color: #3a3a3c;
    cursor: not-allowed;
}

.keyboard {
    margin-bottom: 30px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}

.key {
    padding: 12px 8px;
    font-size: 0.9rem;
    font-weight: bold;
    background-color: #818384;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    min-width: 40px;
}

.key:hover {
    background-color: #565758;
}

.key:active {
    transform: scale(0.95);
    background-color: #3a3a3c;
}

.key.correct {
    background-color: #538d4e;
}

.key.present {
    background-color: #b59f3b;
}

.key.absent {
    background-color: #3a3a3c;
}

.enter-key, .backspace-key {
    min-width: 60px;
    font-size: 0.8rem;
}

.game-messages {
    text-align: center;
    margin-bottom: 20px;
    min-height: 30px;
}

#message-display {
    font-size: 1.1rem;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

#message-display.success {
    background-color: #538d4e;
    color: #ffffff;
}

#message-display.error {
    background-color: #dc3545;
    color: #ffffff;
}

#message-display.info {
    background-color: #3a3a3c;
    color: #ffffff;
}


@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .header-title-row {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .settings-container {
        align-self: flex-end;
        position: absolute;
        top: 0;
        right: 0;
    }
    
    .settings-menu {
        right: 0;
    }
    
    .grid {
        width: 250px;
        height: 300px;
    }
    
    .cell {
        font-size: 1.2rem;
    }
    
    .input-section {
        flex-direction: column;
        align-items: center;
    }
    
    #guess-input {
        width: 100%;
        max-width: 250px;
    }
    
    .chat-mini {
        max-width: 100%;
    }
    
    .chat-modal {
        width: 95%;
        height: 85%;
    }
    
    /* Mobile keyboard optimization */
    .keyboard {
        margin-bottom: 20px;
        width: 100%;
        max-width: 320px;
        margin: 0 auto 20px;
    }
    
    .keyboard-row {
        gap: 4px;
        margin-bottom: 6px;
    }
    
    .key {
        padding: 14px 6px;
        font-size: 0.8rem;
        min-width: 28px;
        height: 50px;
        flex: 1;
    }
    
    .key[data-action="enter"],
    .key[data-action="backspace"] {
        flex: 1.5;
        font-size: 0.7rem;
    }
    
    /* Better touch targets for mobile */
    button, .key, .primary-btn, .secondary-btn {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* Fix input zoom on iOS */
    input[type="text"] {
        font-size: 16px !important;
    }
    
    /* Lobby optimization for mobile */
    .lobby-options {
        padding: 15px;
    }
    
    .join-game-section {
        flex-direction: column;
        gap: 10px;
    }
    
    #game-id-input {
        width: 100%;
    }
    
    /* Message display optimization */
    #message-display {
        font-size: 0.9rem;
        padding: 8px;
    }
}

/* Chat Modal/Overlay Styles */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.chat-overlay.active {
    display: flex;
}

.chat-modal {
    background-color: #1a1a1b;
    border-radius: 12px;
    border: 1px solid #3a3a3c;
    width: 90%;
    max-width: 500px;
    height: 80%;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #3a3a3c;
    background-color: #2a2a2b;
    border-radius: 12px 12px 0 0;
}

.chat-header h3 {
    color: #ffffff;
    font-size: 1.1rem;
    margin: 0;
}

.close-chat-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    color: #ffffff;
}

.close-chat-btn:hover {
    background-color: #dc3545;
}

.chat-content {
    display: flex;
    flex-direction: column;
    height: 500px;
    transition: all 0.3s ease;
}

.chat-content.collapsed {
    height: 0;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    scroll-behavior: smooth;
}

.chat-message {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 85%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

.chat-message.player1 {
    background-color: #538d4e;
    color: #ffffff;
    align-self: flex-start;
    margin-left: 0;
    margin-right: auto;
}

.chat-message.player2 {
    background-color: #b59f3b;
    color: #ffffff;
    align-self: flex-end;
    margin-left: auto;
    margin-right: 0;
}

.chat-message.system {
    background-color: #3a3a3c;
    color: #cccccc;
    align-self: center;
    margin-left: auto;
    margin-right: auto;
    font-style: italic;
    font-size: 0.9rem;
    text-align: center;
    max-width: 90%;
}

.chat-message .player-name {
    font-weight: bold;
    font-size: 0.8rem;
    display: block;
    margin-bottom: 2px;
    opacity: 0.9;
}

.chat-message .message-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-message .timestamp {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
}

.chat-input-section {
    display: flex;
    gap: 8px;
    padding: 15px;
    border-top: 1px solid #3a3a3c;
    background-color: #1a1a1b;
    border-radius: 0 0 12px 12px;
}

#chat-input {
    flex: 1;
    padding: 10px 12px;
    font-size: 0.9rem;
    border: 1px solid #3a3a3c;
    border-radius: 6px;
    background-color: #2a2a2b;
    color: #ffffff;
    transition: border-color 0.3s ease;
}

#chat-input:focus {
    outline: none;
    border-color: #538d4e;
}

#chat-input::placeholder {
    color: #888;
}

#send-message {
    padding: 10px 16px;
    font-size: 0.9rem;
    background-color: #538d4e;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

#send-message:hover:not(:disabled) {
    background-color: #6aaa64;
}

#send-message:disabled {
    background-color: #3a3a3c;
    cursor: not-allowed;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #1a1a1b;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #3a3a3c;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #565758;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Notification badge */
.chat-toggle.has-new-message::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background-color: #dc3545;
    border-radius: 50%;
    border: 2px solid #2a2a2b;
}

/* End Card Modal Styles */
.end-card-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.end-card-overlay.active {
    display: flex;
}

.end-card {
    background-color: #1a1a1b;
    border-radius: 16px;
    border: 1px solid #3a3a3c;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: endCardSlideIn 0.5s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

@keyframes endCardSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.end-card-header {
    text-align: center;
    padding: 30px 20px 20px;
    background: linear-gradient(135deg, #538d4e 0%, #6aaa64 100%);
    border-radius: 16px 16px 0 0;
    position: relative;
}

.end-card-header.defeat {
    background: linear-gradient(135deg, #dc3545 0%, #ff6b6b 100%);
}

.end-card-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.end-card-header h2 {
    color: #ffffff;
    font-size: 2rem;
    margin: 0 0 5px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.end-card-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin: 0;
}

.end-card-content {
    padding: 30px;
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    text-align: center;
    background-color: #2a2a2b;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #3a3a3c;
}

.stat-label {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffffff;
}

.word-reveal {
    background: linear-gradient(135deg, #538d4e, #6aaa64);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.collaboration-info {
    background-color: #2a2a2b;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #3a3a3c;
}

.collaboration-info h3 {
    color: #ffffff;
    font-size: 1.2rem;
    margin: 0 0 15px 0;
    text-align: center;
}

.player-contributions {
    display: flex;
    justify-content: space-around;
    gap: 15px;
}

.contribution {
    text-align: center;
    flex: 1;
}

.contribution .player-name {
    display: block;
    color: #ffffff;
    font-weight: bold;
    margin-bottom: 5px;
}

.contribution .contribution-count {
    display: block;
    color: #888;
    font-size: 0.9rem;
}

.end-card-actions {
    padding: 0 30px 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.action-btn {
    flex: 1;
    padding: 15px 20px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn.primary {
    background-color: #538d4e;
    color: #ffffff;
}

.action-btn.primary:hover {
    background-color: #6aaa64;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(83, 141, 78, 0.3);
}

.action-btn.secondary {
    background-color: #3a3a3c;
    color: #ffffff;
}

.action-btn.secondary:hover {
    background-color: #565758;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(58, 58, 60, 0.3);
}

@media (max-width: 480px) {
    .end-card {
        width: 95%;
        margin: 10px;
    }
    
    .end-card-header {
        padding: 20px 15px 15px;
    }
    
    .end-card-header h2 {
        font-size: 1.6rem;
    }
    
    .end-card-content {
        padding: 20px;
    }
    
    .game-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .player-contributions {
        flex-direction: column;
        gap: 10px;
    }
    
    .end-card-actions {
        padding: 0 20px 20px;
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
}

/* Lobby Styles */
#lobby-screen {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

#lobby-screen header {
    margin-bottom: 50px;
}

.subtitle {
    font-size: 1.2rem;
    color: #888;
    margin-top: 10px;
}

/* Main Menu styles */
.main-menu-content {
    background-color: #1a1a1b;
    border-radius: 16px;
    padding: 40px;
    border: 1px solid #3a3a3c;
}

/* Game Room styles */
.game-room-content {
    background-color: #1a1a1b;
    border-radius: 16px;
    padding: 40px;
    border: 1px solid #3a3a3c;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    z-index: 10;
}

.close-btn:hover {
    background: rgba(255, 100, 100, 0.2);
    border-color: rgba(255, 100, 100, 0.4);
    color: rgba(255, 100, 100, 0.9);
    transform: scale(1.1);
}

.close-icon {
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
}

.clickable-title {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.3);
}


/* Legacy lobby styles */
.lobby-content {
    background-color: #1a1a1b;
    border-radius: 16px;
    padding: 40px;
    border: 1px solid #3a3a3c;
}

.lobby-options {
    margin-bottom: 30px;
}

.primary-btn {
    background-color: #538d4e;
    color: #ffffff;
    border: none;
    padding: 16px 32px;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-bottom: 20px;
}

.primary-btn:hover {
    background-color: #6aaa64;
}

.secondary-btn {
    background-color: #818384;
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.secondary-btn:hover {
    background-color: #565758;
}

.divider {
    margin: 20px 0;
    color: #888;
    font-size: 1rem;
}

.join-game-section {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

#game-id-input {
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid #3a3a3c;
    border-radius: 8px;
    background-color: #121213;
    color: #ffffff;
    width: 200px;
}

#game-id-input:focus {
    outline: none;
    border-color: #538d4e;
}

.lobby-info {
    border-top: 1px solid #3a3a3c;
    padding-top: 30px;
    margin-top: 30px;
}

.game-link-section {
    margin-bottom: 30px;
}

.game-link-section h3 {
    margin-bottom: 15px;
    color: #ffffff;
}

.link-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

#game-link {
    padding: 12px 16px;
    font-size: 0.9rem;
    border: 2px solid #3a3a3c;
    border-radius: 8px;
    background-color: #2a2a2b;
    color: #ffffff;
    width: 300px;
    text-align: center;
}

#copy-link-btn {
    background-color: #b59f3b;
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#copy-link-btn:hover {
    background-color: #d4b942;
}

.players-waiting h3 {
    margin-bottom: 15px;
    color: #ffffff;
}

#lobby-players {
    margin-bottom: 20px;
}

.lobby-player {
    display: inline-block;
    padding: 8px 16px;
    margin: 5px;
    background-color: #3a3a3c;
    border-radius: 20px;
    font-size: 0.9rem;
}

.lobby-player.ready {
    background-color: #538d4e;
}

.lobby-player.you {
    border: 2px solid #b59f3b;
}

.ready-btn {
    background-color: #538d4e;
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.ready-btn:hover:not(:disabled) {
    background-color: #6aaa64;
}

.ready-btn:disabled {
    background-color: #3a3a3c;
    cursor: not-allowed;
    opacity: 0.5;
}

.ready-btn.ready {
    background-color: #b59f3b;
}

.ready-btn.ready:hover {
    background-color: #d4b942;
}

@media (max-width: 480px) {
    .lobby-content {
        padding: 20px;
    }
    
    .link-container {
        flex-direction: column;
    }
    
    #game-link {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .join-game-section {
        flex-direction: column;
    }
    
    #game-id-input {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Game Mode Selection */
.game-mode-selection {
    margin-bottom: 2rem;
}

.game-mode-selection h3 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: white;
    font-size: 1.3rem;
}

.mode-selection-subtitle {
    text-align: center;
    margin-bottom: 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.join-game-section h3 {
    text-align: center;
    margin-bottom: 1rem;
    color: white;
    font-size: 1.3rem;
}

.divider-section {
    margin: 2rem 0;
}

.game-mode-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.create-join-section {
    animation: fadeIn 0.3s ease;
}

/* Game Room Card Sections */
.game-room-content > div {
    margin-bottom: 2rem;
}

.game-room-content > div:last-child {
    margin-bottom: 0;
}

/* Game Mode Display */
.game-mode-display {
    text-align: center;
    margin-bottom: 2rem;
}

.mode-badge-large {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: rgba(83, 141, 78, 0.15);
    border: 2px solid rgba(83, 141, 78, 0.3);
    border-radius: 12px;
    color: white;
}

.mode-badge-large.competitive {
    background: rgba(255, 100, 100, 0.15);
    border-color: rgba(255, 100, 100, 0.3);
}

.mode-icon-large {
    font-size: 1.5rem;
}

.mode-name-large {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Share and Code Sections */
.share-section, .game-code-section {
    text-align: center;
}

.share-section h3, .game-code-section h3 {
    margin-bottom: 1rem;
    color: white;
    font-size: 1.1rem;
}

.link-container, .code-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.link-container input, .code-container input {
    flex: 1;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 0.9rem;
}

.copy-btn {
    padding: 0.75rem 1rem;
    background: #538d4e;
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.copy-btn:hover {
    background: #6aaa64;
}

/* Players Section */
.players-section h3 {
    margin-bottom: 1rem;
    color: white;
    font-size: 1.1rem;
    text-align: center;
}

.players-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.player-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    position: relative;
}

.player-card.ready {
    background: rgba(83, 141, 78, 0.1);
    border-color: rgba(83, 141, 78, 0.3);
}

.player-card.empty {
    border-style: dashed;
    opacity: 0.6;
}

.player-card.clickable {
    transition: all 0.3s ease;
}

.player-card.clickable:hover {
    background: rgba(83, 141, 78, 0.1);
    border-color: rgba(83, 141, 78, 0.3);
    transform: translateY(-2px);
}

.player-name {
    font-weight: 600;
    color: white;
    margin-bottom: 0.5rem;
}

.player-status {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.player-ready-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    color: #538d4e;
    font-size: 1.2rem;
}

/* Status Section */
.status-section {
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-status-text {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
}

.game-status-text.ready {
    color: #538d4e;
    font-weight: 600;
}

.game-status-text.starting {
    color: #b59f3b;
    font-weight: 600;
    font-size: 1.2rem;
}

.game-mode-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.mode-btn {
    flex: 1;
    min-width: 200px;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.mode-btn.selected {
    background: rgba(83, 141, 78, 0.3);
    border-color: #538d4e;
}

.mode-icon {
    font-size: 2rem;
}

.mode-name {
    font-size: 1.2rem;
    font-weight: 600;
}

.mode-desc {
    font-size: 0.9rem;
    opacity: 0.8;
    text-align: center;
}

/* Word Selection Modal */
.word-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.word-selection-overlay.active {
    display: flex;
}

.word-selection-modal {
    background: #1a1a2e;
    border-radius: 15px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.word-selection-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.word-selection-header h2 {
    margin-bottom: 0.5rem;
    color: white;
}

.word-selection-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.timer-display {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.timer-icon {
    font-size: 1.2rem;
}

.timer-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
}

.timer-display.warning {
    background: rgba(255, 100, 100, 0.3);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

.word-cloud-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin: 2rem 0;
    min-height: 120px;
}

.word-cloud-item {
    padding: 0.75rem 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    color: #d7dadc;
    cursor: pointer;
    transition: all 0.3s ease;
    transform: scale(1);
    letter-spacing: 0.1em;
}

.word-cloud-item:hover {
    border-color: #538d4e;
    transform: scale(1.05);
    color: white;
    background: rgba(83, 141, 78, 0.2);
}

.word-cloud-item.selected {
    border-color: #538d4e;
    background: #538d4e;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(83, 141, 78, 0.4);
}

.word-cloud-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(0.95);
}

.word-preview {
    text-align: center;
    padding: 1.5rem;
    background: rgba(83, 141, 78, 0.2);
    border-radius: 10px;
    border: 2px solid #538d4e;
}

.preview-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
}

.preview-word {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.3rem;
    color: white;
}

.word-selection-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.word-selection-actions .action-btn {
    min-width: 200px;
}

/* Progress Button Styles */
.progress-btn {
    position: relative;
    overflow: hidden;
    border: 2px solid #538d4e;
    background: transparent;
    transition: all 0.3s ease;
}

.progress-btn:not(:disabled) {
    background: #538d4e;
}

.progress-btn:disabled {
    background: transparent;
    color: #d7dadc;
    border-color: #538d4e;
    cursor: default;
    pointer-events: none;
}

.progress-btn:disabled.auto-progressing {
    color: #d7dadc;
    border-color: #538d4e;
    pointer-events: none;
}

.progress-btn:hover {
    /* Remove any hover effects to indicate it's not interactive */
    background: transparent;
    transform: none;
}

.progress-btn .btn-text {
    position: relative;
    z-index: 2;
    display: block;
    pointer-events: none;
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6aaa64, #538d4e);
    transition: width linear;
    z-index: 1;
}

.progress-btn.auto-progressing .progress-fill {
    animation: fillProgress 10s linear forwards;
}

@keyframes fillProgress {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shuffleIn {
    0% {
        opacity: 0;
        transform: translateY(30px) rotate(-10deg) scale(0.5);
    }
    60% {
        opacity: 1;
        transform: translateY(-5px) rotate(3deg) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotate(0deg) scale(1);
    }
}

/* Turn Transition Silhouettes */
.turn-silhouette {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    border-radius: 8px;
}

.turn-silhouette.active {
    opacity: 1;
}

.turn-silhouette-content {
    text-align: center;
    color: white;
    padding: 2rem;
    max-width: 300px;
}

.turn-silhouette-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #6aaa64;
}

.turn-silhouette-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.4;
}

.turn-silhouette-word {
    font-weight: 700;
    color: #f7da21;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

/* Game board positioning for silhouette */
.game-board {
    position: relative;
}

/* Hide keyboard and input during spectating */
.keyboard.hidden {
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.input-section.hidden {
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Full Page Countdown */
.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.countdown-overlay.active {
    display: flex;
}

.countdown-content {
    text-align: center;
    color: white;
}

.countdown-number {
    font-size: 15rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 1rem;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
    animation: countdownPulse 1s ease-in-out;
}

.countdown-number.go {
    font-size: 8rem;
    color: #538d4e;
    text-shadow: 0 0 30px rgba(83, 141, 78, 0.8);
}

.countdown-text {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.countdown-mode {
    font-size: 1.5rem;
    opacity: 0.7;
    font-weight: 500;
}

@keyframes countdownPulse {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.countdown-number.final {
    animation: countdownFinal 0.8s ease-out;
}

@keyframes countdownFinal {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1.1);
    }
}

/* Game Mode Indicator */
.game-mode-indicator {
    text-align: center;
    margin: 1rem 0;
}

.mode-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.9rem;
    color: white;
    font-weight: 500;
}

.mode-badge.competitive {
    background: rgba(255, 100, 100, 0.2);
    border: 1px solid rgba(255, 100, 100, 0.5);
}

.mode-badge.cooperative {
    background: rgba(83, 141, 78, 0.2);
    border: 1px solid rgba(83, 141, 78, 0.5);
}