* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #f5f5f7;
    padding: 2rem;
}

.back-button {
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    background: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 2rem;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: rgba(0, 0, 0, 0.1);
}

.calculator {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 375px;
}

.display {
    grid-column: 1 / -1;
    background: rgba(0, 0, 0, 0.03);
    padding: 24px;
    margin-bottom: 12px;
    border-radius: 14px;
    text-align: right;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    word-wrap: break-word;
    word-break: break-all;
}

.previous-operand {
    color: #86868b;
    font-size: 1.2rem;
    min-height: 1.5rem;
}

.current-operand {
    color: #1d1d1f;
    font-size: 3rem;
    font-weight: 400;
    line-height: 1.1;
}

button {
    font-size: 1.5rem;
    padding: 16px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.1s ease;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:active {
    transform: scale(0.95);
}

.number {
    background: rgba(255, 255, 255, 0.9);
    color: #1d1d1f;
}

.number:hover {
    background: rgba(255, 255, 255, 1);
}

.secondary {
    background: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
}

.secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

.accent {
    background: #007AFF;
    color: white;
}

.accent:hover {
    background: #0066d6;
}

.span-2 {
    grid-column: span 2;
    border-radius: 25px;
    aspect-ratio: 2;
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: #000000;
    }

    .back-button {
        background: rgba(255, 255, 255, 0.1);
        color: #f5f5f7;
    }

    .back-button:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    .calculator {
        background: rgba(30, 30, 30, 0.8);
    }

    .display {
        background: rgba(255, 255, 255, 0.05);
    }

    .previous-operand {
        color: #86868b;
    }

    .current-operand {
        color: #f5f5f7;
    }

    .number {
        background: rgba(255, 255, 255, 0.1);
        color: #f5f5f7;
    }

    .number:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    .secondary {
        background: rgba(255, 255, 255, 0.05);
        color: #f5f5f7;
    }

    .secondary:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}