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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.calculator {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 380px;
}

.display {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    text-align: right;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.expression {
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    min-height: 24px;
    word-break: break-all;
    margin-bottom: 8px;
}

.result {
    color: #fff;
    font-size: 36px;
    font-weight: 300;
    word-break: break-all;
}

.mode-switch {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.mode-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    background: rgba(99, 102, 241, 0.3);
    color: #fff;
}

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

.btn {
    padding: 16px 8px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

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

.num {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.num:hover {
    background: rgba(255, 255, 255, 0.15);
}

.func {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    font-size: 14px;
}

.func:hover {
    background: rgba(99, 102, 241, 0.3);
}

.op {
    background: rgba(251, 146, 60, 0.25);
    color: #fdba74;
}

.op:hover {
    background: rgba(251, 146, 60, 0.35);
}

.equal {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    grid-column: span 1;
}

.equal:hover {
    background: linear-gradient(135deg, #818cf8, #a78bfa);
}

.zero {
    grid-column: span 2;
}

@media (max-width: 400px) {
    .btn {
        padding: 14px 6px;
        font-size: 14px;
    }
    .result {
        font-size: 28px;
    }
}
