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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #1e1e1e, #2d2d2d);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

.calculator {
    background: #1c1c1e;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    width: 320px;
}

.display {
    background: transparent;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 10px;
    text-align: right;
    min-height: 80px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

.display-text {
    color: white;
    font-size: 48px;
    font-weight: 200;
    letter-spacing: -1px;
    word-break: break-all;
    max-width: 100%;
    overflow: hidden;
}

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

.btn {
    border: none;
    border-radius: 50%;
    /* Ajustamos el tamaño para que quepa en el contenedor */
    width: 62px;
    height: 62px;
    font-size: 24px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.1s ease;
    outline: none;
    font-family: inherit;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.btn:active {
    transform: scale(0.95);
}

/* Botones numéricos y decimal - gris oscuro */
.btn.number {
    background: #333333;
    color: white;
}

.btn.number:hover {
    background: #404040;
}

.btn.number:active {
    background: #505050;
}

/* Botones de funciones superiores - gris claro */
.btn.function {
    background: #a6a6a6;
    color: black;
    font-weight: 500;
}

.btn.function:hover {
    background: #b8b8b8;
}

.btn.function:active {
    background: #999999;
}

/* Botones de operadores - naranja */
.btn.operator {
    background: #ff9500;
    color: white;
    font-weight: 500;
}

.btn.operator:hover {
    background: #ffb143;
}

.btn.operator:active,
.btn.operator.active {
    background: white;
    color: #ff9500;
}

/* Botón 0 - doble ancho */
.btn.zero {
    grid-column: span 2;
    border-radius: 31px;
    /* Ajustamos el ancho del botón cero (62*2 + 12 de gap) */
    width: 136px;
    justify-content: flex-start;
    padding-left: 24px;
}

/* Efectos de sombra para botones */
.btn {
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn:active {
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Responsive para pantallas más pequeñas */
@media (max-width: 380px) {
    .calculator {
        width: 95vw;
        padding: 15px;
    }

    .btn {
        width: 60px;
        height: 60px;
        font-size: 22px;
    }

    .btn.zero {
        width: 132px;
    }

    .display-text {
        font-size: 42px;
    }
}