:root {
    --calculator-bg: #2e2e2e; /* Dark background */
    --display-bg: #4f4f4f; /* Slightly lighter dark for display */
    --text-color: #f0f0f0; /* Light text */
    --operator-color: #f7a048; /* PowerOne-like orange/gold accent */
    --button-bg: #404040; /* Darker button background */
    --button-hover-bg: #5a5a5a; /* Button hover effect */
    --clear-delete-bg: #606060; /* Slightly different for AC/DEL */
    --clear-delete-hover-bg: #7a7a7a;
    --equals-bg: #4a8df0; /* Another accent for equals, or use operator-color */
    --equals-hover-bg: #5a9cf0;
    --font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; /* Clean sans-serif */
}

body {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #1a1a1a; /* Even darker background for the body */
    font-family: var(--font-family);
    color: var(--text-color);
}

.calculator {
    background-color: var(--calculator-bg);
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    width: 320px; /* Typical calculator width */
    display: grid;
    grid-template-rows: minmax(120px, auto) repeat(5, 70px); /* Display + 5 rows of buttons */
    grid-template-columns: repeat(4, 1fr);
    padding: 15px; /* Inner padding */
    gap: 10px; /* Space between buttons */
}

.display {
    grid-column: 1 / -1;
    background-color: var(--display-bg);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-around;
    padding: 15px 20px;
    word-wrap: break-word;
    word-break: all;
    border-radius: 10px;
    margin-bottom: 10px; /* Space between display and first row of buttons */
}

.display .previous-operand {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    height: 1.2rem; /* Reserve space */
    min-height: 1.2rem;
}

.display .current-operand {
    color: var(--text-color);
    font-size: 3rem;
    font-weight: bold;
    min-height: 3rem; /* Reserve space */
}

.buttons {
    display: contents; /* Allows children to participate in the grid directly */
}

button {
    cursor: pointer;
    font-size: 1.8rem;
    border: none;
    outline: none;
    border-radius: 10px; /* Slightly rounded buttons */
    background-color: var(--button-bg);
    color: var(--text-color);
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: flex; /* For centering text */
    justify-content: center;
    align-items: center;
    font-weight: 500;
}

button:hover {
    background-color: var(--button-hover-bg);
}

button:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Specific button styling */
.span-two {
    grid-column: span 2;
}

.operator {
    background-color: var(--operator-color);
    color: white; /* Operators usually stand out with white text on color */
}

.operator:hover {
    background-color: #f9b068; /* Lighter orange on hover */
}

.operator:active {
    background-color: #e59038; /* Darker orange on active */
}

.clear,
button[data-action="delete"] {
    background-color: var(--clear-delete-bg);
    font-size: 1.5rem; /* Slightly smaller text for AC/DEL */
    color: var(--text-color);
}

.clear:hover,
button[data-action="delete"]:hover {
    background-color: var(--clear-delete-hover-bg);
}

.equals {
    background-color: var(--equals-bg);
}

.equals:hover {
    background-color: var(--equals-hover-bg);
}

/* Optional: Make text scale for smaller displays */
@media (max-width: 400px) {
    .calculator {
        width: 90vw;
    }
    .display .current-operand {
        font-size: 2.5rem;
    }
    button {
        font-size: 1.5rem;
    }
}
