:root {
    --bg-gradient: radial-gradient(circle at top left, #1e293b, #0f172a);
    --calculator-bg: #1e293b;
    --display-bg: rgba(15, 23, 42, 0.8);
    --btn-number-bg: #334155;
    --btn-operator-bg: #475569;
    --btn-accent-bg: #f59e0b;
    --btn-primary-bg: #3b82f6;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --shadow-color: rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    background: var(--bg-gradient);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-color);
    overflow: hidden;
}

.calculator-container {
    width: 100%;
    max-width: 380px;
    padding: 20px;
}

.calculator {
    background-color: var(--calculator-bg);
    border-radius: 32px;
    padding: 24px;
    box-shadow: 0 20px 50px var(--shadow-color);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.display {
    background-color: var(--display-bg);
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 24px;
    text-align: right;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.history {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    height: 1.2em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.current {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 2.8rem;
    font-weight: 500;
    word-wrap: break-word;
    word-break: break-all;
    line-height: 1.1;
}

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

.btn {
    border: none;
    border-radius: 18px;
    height: 64px;
    font-size: 1.4rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

.btn:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

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

.btn-operator {
    background-color: var(--btn-operator-bg);
    font-size: 1.2rem;
}

.btn-accent {
    background-color: var(--btn-accent-bg);
    font-weight: 600;
}

.btn-primary {
    background-color: var(--btn-primary-bg);
    font-size: 1.8rem;
}

.btn-zero {
    grid-column: span 2;
    aspect-ratio: auto;
}

/* Animations */
@keyframes press {
    0% { transform: scale(1); }
    50% { transform: scale(0.92); }
    100% { transform: scale(1); }
}

.btn-clicked {
    animation: press 0.1s ease-out;
}

/* Responsive adjustments */
@media (max-width: 400px) {
    .calculator-container {
        padding: 12px;
    }
    
    .calculator {
        padding: 16px;
    }
    
    .buttons {
        gap: 12px;
    }
    
    .btn {
        height: 58px;
        font-size: 1.2rem;
    }
    
    .current {
        font-size: 2.2rem;
    }
}
