:root {
    --bg-color: #121212;
    --calc-bg: #1E1E1E;
    --btn-grey: #2C2C2C;
    --btn-light-grey: #A5A5A5;
    --btn-orange: #FF9F0A;
    --text-white: #FFFFFF;
    --text-black: #000000;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-white);
}

.calculator {
    background-color: var(--calc-bg);
    width: 100%;
    max-width: 380px;
    padding: 24px;
    border-radius: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    position: relative;
}

.branding {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--btn-orange);
    text-align: center;
    margin-bottom: -10px;
    opacity: 0.8;
    text-transform: uppercase;
}

.display {
    height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    padding: 0 10px 20px 10px;
    overflow: hidden;
}

.previous-operand {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    margin-bottom: 8px;
    height: 1.2rem;
}

.current-operand {
    font-size: 4.5rem;
    font-weight: 300;
    white-space: nowrap;
    transition: font-size 0.1s ease;
}

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

button {
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: none;
    font-size: 1.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
}

button:active {
    transform: scale(0.92);
    filter: brightness(1.2);
}

button.number {
    background-color: var(--btn-grey);
    color: var(--text-white);
}

button.number:hover {
    background-color: #3D3D3D;
}

button.operator {
    background-color: var(--btn-orange);
    color: var(--text-white);
}

button.operator:hover {
    background-color: #FFB340;
}

button.special {
    background-color: var(--btn-light-grey);
    color: var(--text-black);
}

button.special:hover {
    background-color: #D4D4D4;
}

button.double {
    grid-column: span 2;
    aspect-ratio: auto;
    border-radius: 50px;
    justify-content: flex-start;
    padding-left: 32px;
}

/* Responsive font sizing for display */
.current-operand.long { font-size: 3.5rem; }
.current-operand.very-long { font-size: 2.5rem; }
