body {
    font-family: Arial, sans-serif;
    text-align: center;
    background-color: #f4f4f4;
}

.container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-top: 20px;
}

.sidebar {
    width: 160px;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calculator {
    width: 90%;
    max-width: 320px;
    margin: 0 20px;
    padding: 20px;
    background: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#display {
    width: 100%;
    height: 50px;
    text-align: right;
    font-size: 1.5em;
    padding: 10px;
    border: none;
    background: #eee;
    border-radius: 5px;
    overflow-x: auto;
    white-space: nowrap;
    direction: ltr;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
}

button {
    padding: 12px;
    font-size: 1.1em;
    border: none;
    background: #ddd;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    height: 50px;
}

button:hover {
    background: #ccc;
}

button:nth-child(4n) {
    background: #ff9800;
    color: white;
}

button:nth-child(4n):hover {
    background: #e68900;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
        align-items: center;
    }
    
    .sidebar {
        display: none;
    }

    .calculator {
        margin: 20px 0;
    }
}
