:root {
    --bg-color: hsl(0, 0%, 95%);
    --calc-bg: hsl(0, 0%, 15%);
    --display-bg: hsl(0, 0%, 20%);
    --button-bg: hsl(0, 0%, 30%);
    --text-color: white;
    --operator-bg: hsl(190, 100%, 40%);
}

.light-mode {
    --bg-color: hsl(0, 0%, 90%);
    --calc-bg: hsl(0, 0%, 98%);
    --display-bg: hsl(0, 0%, 98%);
    --button-bg: hsl(0, 0%, 88%);
    --text-color: hsl(0, 0%, 20%);
    --operator-bg: hsl(190, 70%, 60%);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-color);
    overflow: hidden;
    transition: background-color 0.3s ease;
    /* Added for a smooth fade! */
}

#calculator {
    font-family: arial, sans-serif;
    background-color: var(--calc-bg);
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    max-height: 95vh;
    overflow: hidden;
    box-shadow: 0px 15px 35px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease;
}

#display {
    width: 100%;
    padding: 30px;
    font-size: 3rem;
    text-align: left;
    border: none;
    background-color: var(--display-bg);
    color: var(--text-color);
    font-family: 'Lucida Sans', sans-serif;
    outline: none;
}

#display:focus {
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

#keys {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 20px;
    justify-items: center;
}

button {
    width: 100%;
    aspect-ratio: 1/1;
    height: auto;
    border-radius: 50%;
    border: none;
    background-color: var(--button-bg);
    color: var(--text-color);
    font-size: 1.5em;
    cursor: pointer;
    font-weight: bold;
    font-family: 'Lucida Sans', sans-serif;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0px 4px 0px rgba(0, 0, 0, 0.05);
}

button:hover {
    filter: brightness(1.2);
}

button:active {
    transform: translateY(2px);
    box-shadow: none;
}

.operator-btn {
    background-color: var(--operator-bg);
    color: black;
}

.equals-btn {
    grid-column: span 4;
    width: 100%;
    aspect-ratio: auto;
    height: 60px;
    border-radius: 30px;
}

/* This class will be added/removed by JavaScript */
.active-key {
    background-color: #e0e0e0 !important;
    /* Slightly darker than light mode buttons */
    transform: scale(0.95);
    /* Shrinks it slightly as if pressed */
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2) !important;
    /* Inner shadow for depth */
    transition: all 0.1s ease;
}

/* For your operator buttons, maybe a different color blink */
.operator.active-key {
    background-color: #d14d3d !important;
    /* Darker version of your orange/red */
}

#theme-toggle {
    width: 100%;
    height: 40px;
    background-color: transparent;
    color: var(--text-color);
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.7;
}