* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.calculator {
    width: 100vw;
    max-width: 100%;
    background: #000;
    padding: 0 8px 8px 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    position: relative;
}

.secret-area {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 80px;
    height: 80px;
    z-index: 10;
    cursor: pointer;
}

.display {
    color: #fff;
    font-size: 96px;
    font-weight: 200;
    text-align: right;
    padding: 20px 24px;
    min-height: 200px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    overflow: hidden;
    white-space: nowrap;
    line-height: 1;
}

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

.btn {
    border: none;
    border-radius: 50%;
    font-size: 38px;
    font-weight: 300;
    cursor: pointer;
    transition: opacity 0.1s;
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn:active {
    opacity: 0.5;
}

.btn.number {
    background: #333;
    color: #fff;
}

.btn.operator {
    background: #ff9f0a;
    color: #fff;
    font-size: 42px;
}

.btn.operator.active {
    background: #fff;
    color: #ff9f0a;
}

.btn.function {
    background: #a5a5a5;
    color: #000;
    font-size: 32px;
}

.btn.zero {
    grid-column: span 2;
    border-radius: 50px;
    aspect-ratio: 2.2 / 1;
    justify-content: flex-start;
    padding-left: 36px;
}

@media (max-width: 400px) {
    .display {
        min-height: 160px;
    }
    
    .buttons {
        gap: 10px;
    }
    
    .btn {
        font-size: 32px;
    }
    
    .btn.operator {
        font-size: 36px;
    }
    
    .btn.function {
        font-size: 28px;
    }
}

@media (min-width: 400px) {
    .calculator {
        max-width: 428px;
    }
}
