*, *::before, *::after {
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: bold;
}

body {
    margin: 0;
    background: linear-gradient(to right, #4a00e0, #8e2de2);
    /* Prevent scrolling on the body */
    overflow: hidden; 
}

body::before {
    content: 'CALCULATOR';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 15vw;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.07);
    z-index: -1;
    user-select: none;
}

/* ==========================================
  Calculator Grid Layout (Desktop Version)
  ==========================================
*/
.calculator-grid {
    display: grid;
    justify-content: center; /* Center horizontally */
    align-content: center;   /* Center vertically */
    min-height: 100vh;       /* Ensure it takes at least full screen height for centering */

    /* Fixed layout using pixels, suitable for desktop */
    grid-template-columns: repeat(4, 120px); 
    /* Display row + 7 button rows at 75px height */
    grid-template-rows: minmax(100px, auto) repeat(7, 75px); 
}

/* ==========================================
  Button Styling
  ==========================================
*/
.calculator-grid > button {
    cursor: pointer;
    font-size: 2rem;
    border: 1px solid black;
    outline: none;
    background-color: rgba(0, 0, 0, .65);
    color: white;
    /* Smooth transition for hover effect */
    transition: background-color 0.15s ease-in-out;
}

.calculator-grid > button:hover {
    background-color: rgba(0, 0, 0, .8);
}

/* Specific styles for operator buttons */
.operator {
    background-color: #ff9500; /* Orange */
}

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

/* Specific styles for the equals button */
[data-equals].operator {
    background-color: #e000b7; /* Pink */
}

[data-equals].operator:hover {
    background-color: #ff00d4; /* Lighter pink */
}

/* Style for buttons spanning two columns */
.span-two {
    grid-column: span 2;
}

/* ==========================================
  Display Styling
  ==========================================
*/
.output {
    grid-column: 1 / -1; /* Span all columns */
    background-color: rgba(0, 0, 0, .75);
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Align text to the right */
    justify-content: space-around; /* Space out the two lines */
    padding: 10px;
    word-wrap: break-word; /* Wrap long numbers/expressions */
    word-break: break-all;
    min-height: 100px; /* Ensure display has a minimum height */
}

/* Top line (previous operand/equation) */
.previous-operand {
    color: rgba(255, 255, 255, .75);
    font-size: 1.5rem;
}

/* Bottom line (current operand/result) */
.current-operand {
    color: white;
    font-size: 2.5rem;
}

/* Special style for error messages */
.current-operand.error-message {
    font-size: 1.6rem;
    color: rgba(255, 100, 100, 0.85); /* Subtle red */
}