:root {
    --bg-color: #000000;
    --btn-num-bg: #333333;
    --btn-op-bg: #ff9f0a;
    --btn-top-bg: #a5a5a5;
    --text-white: #ffffff;
    --text-black: #000000;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #1c1c1c; /* Slightly lighter than black for browser view */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.calculator-container {
    width: 100%;
    max-width: 400px; /* Mobile size constraint */
    height: 100vh;
    max-height: 850px;
    background-color: var(--bg-color);
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    overflow: hidden;
}

.calculator {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    padding-bottom: 40px;
}

.display-container {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    padding: 20px;
    margin-bottom: 10px;
}

.display {
    color: var(--text-white);
    font-size: 3.5rem; /* Large text */
    font-weight: 300;
    word-wrap: break-word; /* Wrap if too long */
    word-break: break-all;
    text-align: right;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 12px;
}

.btn {
    aspect-ratio: 1; /* Circular */
    border-radius: 50%;
    border: none;
    font-size: 1.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: filter 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-white);
}

.btn:active {
    filter: brightness(1.3);
}

/* Number Buttons */
.btn-number {
    background-color: var(--btn-num-bg);
}

/* Zero button spans 2 columns */
.btn-zero {
    grid-column: span 2;
    aspect-ratio: auto;
    border-radius: 40px;
    justify-content: flex-start;
    padding-left: 28px;
}

/* Operator Buttons */
.btn-operator {
    background-color: var(--btn-op-bg);
    font-size: 2rem;
}

/* Action Buttons (Top row) */
.btn-action {
    background-color: var(--btn-top-bg);
    color: var(--text-black);
}

/* Responsive adjustments for very small screens */
@media (max-width: 350px) {
    .display {
        font-size: 2.5rem;
    }
    .btn {
        font-size: 1.4rem;
    }
}
