body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

h1 {
    text-align: center;
}

.chat {
    height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    margin-bottom: 20px;
    background: #fafafa;
}

.message {
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 4px;
}

.message.registration {
    background: #e3f2fd;
}

.message.system {
    background: #fff3e0;
    text-align: center;
    font-weight: bold;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#user-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.count-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

input, button {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

button {
    background: #007bff;
    color: white;
    cursor: pointer;
}

button:hover {
    background: #0056b3;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#admin-panel {
    border-top: 1px solid #ddd;
    padding-top: 10px;
}

@media (min-width: 760px) {
    .controls {
        display: grid;
        grid-template-columns: 1.5fr 1fr;
        gap: 16px;
    }

    #user-panel,
    #admin-panel {
        width: 100%;
    }
}

@media (max-width: 759px) {
    .container {
        max-width: 95%;
        padding: 5px 15px 15px 15px;
    }

    h1 {
        font-size: 1.2em;
        margin: 5px 0 10px 0;
    }

    .chat {
        height: 600px;
    }

    #user-panel {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        grid-template-areas:
            "name count"
            "text button";
        gap: 10px;
        align-items: center;
    }

    #user-name {
        grid-area: name;
        width: 100%;
        min-width: 0;
    }

    .count-controls {
        grid-area: count;
        justify-self: end;
        align-self: center;
        width: auto;
    }

    #text {
        grid-area: text;
        width: 100%;
        min-width: 0;
    }

    #register-btn {
        grid-area: button;
        width: auto;
        white-space: nowrap;
    }

    #user-panel input,
    #user-panel button,
    #user-panel .count-controls {
        min-height: 42px;
    }

    #admin-panel {
        border-top: none;
        padding-top: 0;
    }
}
